Which agent causes sand dunes to form?

Ocean waves

Gravity

The wind carries the sand until it runs into an obstacle

Weathering of old rocks in the desert