The one-line version
October–April for the Cape. May–September for safari. You can't have both at their peak in the same week, and that's the central timing trade of any South Africa trip.
The Cape (October–April)
Spring to autumn is the Cape's season: dry, warm, windy in places, and when the Winelands, Garden Route, and beaches are at their best. October–November and March–April are the sweet spots — good weather, fewer crowds than midsummer. December–February is peak: hot, busy, and the most expensive window. May–August is wet, green, and quiet — beautiful but not a beach trip.
Safari (May–September)
Dry winter is the safari season: thin bush, animals at the waterholes, cool mornings on the vehicle. It's also the best-value time for Kruger camps. July–August is peak safari and peak cold — pack layers. Summer (November–February) is green and lush and full of young animals and birds, but the bush is thick and game-viewing is harder.
The conflict
The Cape's best months (December–February) are safari's hardest. Safari's best (July–August) is the Cape's wettest. Most people pick one and accept the other is off-peak — September is the genuine compromise: spring in the Cape, the end of the dry safari season, and a good time for both.
When to avoid
Christmas and New Year (South African school holidays) everywhere — prices peak, the Cape is full, and the camps are booked. Easter is the second peak. If you can travel outside those two windows, do.