At stumps at Newlands, West Indies, who are attempting to square the series, were 276 for six.
Ramdin (53) and Jermaine Blackwood (45 not out) put on 94 for the sixth wicket to enable the tourists to finish with a respectable total after it seemed they had squandered the advantage of winning the toss and batting first on an easy-paced pitch.
Harmer took three for 67 and was mainly responsible for the West Indies slipping to 172 for five, dismissing Devon Smith, Leon Johnson and Shivnarine Chanderpaul during an impressive first day of Test cricket.
He made an early impact by taking a wicket with the last ball of his fourth over.
Also Read
It was also the last ball before lunch and came from a disappointing shot by Smith, who made 47 and seemed to be settling down after being beaten several times early on by the South African fast bowlers.
Smith tried to cut a ball which was too close to his body and chopped the ball onto his stumps.
He added 51 for the third wicket with Marlon Samuels before he was deceived by a quicker ball from Harmer which curved in with the arm and struck the batsman on his front pad deep in his crease.
The leg before wicket decision was so obvious that Johnson did not even contemplate asking for a review, departing for the dressing room immediately.