What are the conditions for cactus to grow in Terraria?

The wiki now lists the following requirements for Cacti to grow:

  • The target Sand Block is above 0 ft and is not actuated or sloped in any way.
  • The target block is more than 378 tiles away from the lateral edges of the world, i.e. not in the zone where the Ocean biome is usually located.
  • The tiles above and to both sides of the target Sand Block (only the directly adjacent ones) are open space.
  • The tile above the target block is not filled with any liquid.
  • There are fewer than 4 Cactus tiles and more than 10 Sand Blocks (or Ebon-, Crim-, or Pearlsand Blocks; all variants are added together) within a 13×5-tile rectangle centered on the tile above the target Sand Block.

You can't plant cactus but all it needs is sand.

Here is a bit of an instructional vid from Youtube.