Caesar left Sicily and for the shores of Africa with 7 legions totaling about 30,000 men and 2,600 cavalry in late December 47 BC. Initially landing with only 3,000 and a handful of cavalry, some contemporary writers have suggested that Caesar suffered a number of minor defeats while waiting for the bulk of his forces. Caesar, not surprisingly makes little mention of any trouble. Regardless, by early January 46 BC the rest of the fleet arrived, bringing Caesar to full strength.
Africa was a stronghold of Republican resistance since Caesar's march across the Rubicon a couple of years earlier. Marcus Porcius Cato, Caesar's bitter opponent, had been run out of Sicily and fled to Africa. The rest of the resistance came from Publius Attius Varus who was already installed as the governor of Africa, Titus Labienus Caesar's former legate, and Quintus Metellus Scipio, who along with Labienus had escaped Pompey's destruction at Pharsalus, and King Juba of Numidia. The Republicans greatly outnumbered Caesar in total, but their commands were split and it seemed no man wanted to yield overall command to a single army.
Over the course of the next three months, both sides played a game of feints, minor skirmishes and the capturing of towns. Caesar's men had difficulty with supply, as seemed to be the usual case, and the Republican's seemed mostly content to disrupt Caesar rather than attack him with full force. While supply was a problem for Caesar, loyalty was the problem for the Republicans. Their men and those of the local auxilia went over to Caesar en masse. Some switched sided because of Caesar's relation to the African conqueror Gaius Marius, but more because of Caesar's legendary ability. His now famous clemency (towards fellow Romans) surely played a part, as well.
After several minor battles, including a naval battle near Adrumentum that sent Varus eventually in flight to Spain, the Republican army combined and lined up for battle near Thapsus. With 8 legions and 60 elephants under Scipio, and approximately 30,000 Numidians under King Juba, the Republicans slightly outnumbered Caesar's 11 total legions. The difference was that Caesar had a mostly veteran army with unquestionable loyalty, while Scipio's men assuredly lacked confidence, which was a common occurrence while facing the great conqueror. Caesar arrived outside Thapsus on April 6, 46 BC to find Scipio lined up in battle formation.
Caesar aligned in a classic Roman formation with 9 legions, leaving 2 in his camp. Supported by cavalry, archers and other auxilia on the wings, Caesar's own soldiers were apparently tired of the delaying game they'd been playing for 3 months. They begged Caesar to give the order for battle, and he certainly obliged. Scipio's was forced into battle simply through geography. Thapsus rests on a strip of land sandwiched between the ocean and a large lake. Caesar blocked off one end of the strip with fortifications to prevent Scipio making any last minute attempts to refuse the battle. When Caesar gave the order to advance his men raced ahead with incredible energy and spirit. Scipio's elephants were turned away by fierce pilum attacks and his cavalry was routed almost from the start. Caesar flanked Scipio and the Republican lines buckled almost before the fighting even started. King Juba, camped away from Scipio's main lines saw the certain defeat and fled with his 30,000 men without even joining the battle.
With a complete rout in progress, many surrendered but 10,000 men in particular had no such luck. They fled to a nearby hill and were pursued by Caesar's now enraged army. Perhaps their show of cowardice, along with the frustration of 4 months of refusal to do battle was too much for Caesar's men to restrain. Despite likely attempts by Caesar to restrain his army, they slaughtered these 10,000 enemy soldiers to a man. Some have suggested that Caesar suffered an epileptic seizure during the battle. By this time he was 54 years old and if he truly had the condition it likely would've been worsening. This might explain why Caesar was unable to stop the slaughter, but in reality its just complete speculation. Caesar had hoped to prevent the escape of his enemies, like what happened after Pharsalus, and he very well could've openly allowed the slaughter. Only history will ever know the truth of the matter.
Despite his efforts, Caesar's enemies did escape, however. Both Labienus and Scipio managed to flee the battle safely. Scipio and whatever survivors he could muster fled to Utica, where Marcus Porcius Cato was in command of the garrison. Caesar followed immediately (certainly a fast recovery from his seizure, if he had one), and captured towns along the way. News of the Republican defeat reached Cato on April 9, 46 BC, and he knew that all was lost. After doing what he could to help people flee the town, he decided there was nothing left for him to do. Likely on April 13, Marcus Porcius Cato retired to his private chambers and fell on his own sword, rather than bow down to Caesar. He was discovered, however, and attempts were made to save his life. In the great martyring of Cato as the bulwark of Roman Republican ideals, it was said that rather than be saved, he ripped out his own organs in order to ensure his death. Caesar, certainly hopeful that he could bring a defeated and pardoned Cato back to Rome was later quoted by Plutarch as saying "Cato, I must grudge you your death, as you grudged me the honor of saving your life."
Over the next two months, resistance was squashed throughout Africa. Even the Numidian King, Juba committed suicide rather than face defeat. Scipio, despite his escape from Thapsus, was killed in a naval engagement near Hippo Regius. Gaius Sallustius Crispus was left to govern Africa, and by June, Caesar adding the conquest of Africa and Numidia to his list of accomplishments sailed back to Rome.