as long as there is:
1. enough sunlight. This doesn’t mean that the sun should “burn” the plant all day long, but it certainly needs to recieve direct sunlight for a few hours each day.
2. an already grown rosemary somewhere, from which you can cut one or two sprigs.
Then, get a nice and comfortable pot; not to small. Put in the pot some good soil combined with natural compost (optional). Rosemary doesn’t need much to grow, however it likes a well drained soil. So, you can also put some river sand or pumice stone in the pot before you add the soil.
Plant the sprigs (1/3 of the sprig in the soil, 2/3 outside)
Water when you see the soil drying. Rosemary doesn’t like overwatering.
Enjoy watching your little rosemary grow!