Pakistan captain Sarfraz Ahmed hit a spirited half-century but could not prevent South Africa's fast bowlers taking control on the first day of the second Test at Newlands on Thursday.
South Africa's decision to pick an all-pace attack paid dividends with all the bowlers picking up wickets as Pakistan were dismissed out for 177 after being sent in on a hard, green-tinged pitch.
Duanne Olivier followed up a match-winning performance in the first Test in Centurion by taking four for 48, while Dale Steyn took three for 48. Sarfraz made 56 after coming in with his team in danger of a total collapse at 54 for five.
Looking to counter-attack at every opportunity, Sarfraz put on 60 for the sixth wicket with Shan Masood (44) and 42 for the seventh wicket with Mohammad Amir (22 not out).
Sarfraz hit nine fours in an 81-ball innings.
Pakistan were nine wickets down at the scheduled tea break, which was delayed by 14 minutes until the last wicket fell.
Pakistan lost their first three wickets for 19 runs, Steyn making the first breakthrough when Fakhar Zaman fended a bouncer to gully to be out for one in the fifth over.
Imam-ul-Haq was leg before wicket to the returning Vernon Philander for eight before Azhar Ali fell to a short ball, fending a lifting delivery from Olivier to first slip after scoring two.
Shan Masood, batting at number three, watched four of his teammates lose their wickets before he and Sarfraz came together in the best partnership of the innings.