SOUTH AFRICANS had only a few days to celebrate the resignation of Jacob Zuma and the swearing-in of a new president, Cyril Ramaphosa, before the hangover set in. A new budget hiked taxes, cut public spending and reminded people how big a mess Mr Zuma left behind.

The budget was presented by Malusi Gigaba, a finance minister whose appointment by Mr Zuma almost a year ago sparked protests against what was seen as a hostile takeover of the Treasury, a department that had stayed professional even as corruption and incompetence flourished elsewhere in the government. Embarrassingly, Mr Gigaba’s budget was marred by the release of a high-court ruling that he had lied under oath in his previous job as minister of home affairs (and photos of him playing “Candy Crush” on his iPad in parliament). Mr Ramaphosa kept him on until the budget so as not to unsettle markets. He may not last much longer.

Mr Ramaphosa’s most urgent task is to kick out of his cabinet the cronies and hacks put there by Mr Zuma. This is harder than it sounds. Fire too many and he risks splitting the ruling African National Congress (ANC), some pundits worry.

At the same time, he must risk upsetting voters by taking the fiscal measures necessary to avoid a downgrade of South Africa’s debt, which would see it kicked out of the major bond indices used by international investors. The budget includes an unpopular increase in value-added tax to start shrinking a yawning fiscal deficit. Even so, a big increase in spending on university education means that public debt is forecast to keep rising until 2023, when it is expected to peak at about 56% of GDP.

Mr Ramaphosa may not be able to act much more boldly, particularly in cutting the wage bill for civil servants. This consumes nearly 35% of the budget, and 14% of GDP, a jaw-dropping figure even by the standards of the OECD, a club mainly of rich countries, where the average is closer to 11%. Public-sector workers are heavily unionised, and the ANC relies on unions to send people door-to-door canvassing for votes at election time.

Too much austerity would risk sparking public-sector strikes. Instead, Mr Ramaphosa hopes to attract investment and spur the economy so that South Africa can grow its way out of its debt crisis. He has a lot of work to do. Although growth is picking up this year, it is still forecast to come in at a sluggish 1.5%, barely above the rate of population growth.

However, Mr Ramaphosa can reasonably expect a post-Zuma bounce. Goolam Ballim, an economist at Standard Bank, reckons that if South Africa had had a better economic manager than Mr Zuma for the past nine years, its GDP would be as much as 25% larger. One reason was that firms held back from making all but the most essential investments so long as Mr Zuma was in charge. Now, under the business-friendly Mr Ramaphosa, they might see things differently. “I see a flood of investment being unleashed,” Mr Ballim says. Even more would flow if Mr Ramaphosa were to scrap a mining charter that scared off investors by forcing companies to hand over shares to black owners.

In time, Mr Ramaphosa may have to pick a fight with unions to help lift the rate at which South Africa’s economy can grow. Currently, unions have immense power: for example, they can impose minimum wages on whole industries, forcing firms that cannot pay them to close. Mr Ramaphosa would be wise to change labour laws that discourage companies from taking on new workers because it is so hard to fire them. Such reforms would make it easier for the unemployed, who are 36% of the workforce, to find jobs. But they would enrage the unions and the South African Communist Party, the two other members of the ANC’s electoral alliance.

With such a daunting in-tray, Mr Ramaphosa is eager to court popularity. Unlike his predecessor, who whizzed around in a motorcade, he has been taking a regular 5am walk, joined by dozens of well-wishers. One ANC official accompanying the president complained to the local press that he had never woken up so early.