At the dockside huge metal containers holding the last of the $170m (£110m) of paraphernalia of the United Nations mission - portable cabins, communications equipment, office furniture, generators, portable lavatories - are being loaded on to cargo ships.
At the airport another plane-load of UN personnel takes off, disappearing into the clear blue sky over the Indian Ocean. The UN peace-keeping force's term in Somalia is drawing to a close. Most civilian staff have left and the last of the Bangladeshi, Egyptian and Pakistani military are being flown out.
At the height of the military operation, which began nearly two years ago, there were 30,000 troops in Somalia. Now there are only a few thousand and by the end of the month all will have gone. The bill is estimated to be more than $2bn.
The UN peace-keepers leave behind mixed feelings. Their presence has helped to bring some order to a shattered country when it erupted into civil war after the January 1991 overthrow of the dictator Siad Barre but they have failed to assist in the establishment of a government structure.
The 1992 famine, aggravated by inter-clan fighting, is now a terrible memory and an uneasy truce reigns in the capital between the rival warlords - Mohamed Farah Aideed and Ali Mahdi. But many fear the vacuum left by the UN withdrawal will give rise to widespread looting and fighting.
Camped near the port among the sand dunes is a unit of US Marines, the vanguard of the US-led coalition task-force sent to assist the evacuation. Operation United Shield involves a multinational force of 10,000 sea, air and ground troops, two-thirds American. For the time being, its full firepower remains hidden aboard an 18-ship flotilla just beyond the horizon. But a French warship lies at anchor nearer shore and the British destroyer HMS Exeter has been visible of late. Each day brings more US helicopters and landing-craft to the shore.
US Marines, who will spearhead the evacuation at the end of this month, have made daily reconnaissance trips to check suitable landing points. Some 2,600 US Marines, backed by 500 Italian troops, will take control of the port and airport perimeters in an attempt to secure a speedy withdrawal.
This will be the first time the Americans have appeared in force on Somali soil for nearly a year. Then they lost 36 men in clashes with the rival factions led by Mr Aideed, who still controls the southern part of the city, and the self-declared president, Ali Mahdi, holder of the northern- most districts.
Their mission began as a humanitarian aid operation in December 1992 and many Somali lives were saved by the food convoys they helped to get through. But it soon degenerated into open conflict with the warlords, particularly with Mr Aideed, whom they tried in vain to hunt down.
Much military hardware was destroyed, but so were the lives of unknown hundreds of Somalis, many of them innocent civilians.
And, in subduing the civil war that had raged for more than a year, the Americans created a legacy of bitterness and hatred their reappearance will do nothing to quell. In particular, many Somalis are unprepared to forgive an October 1993 air and ground attack on a residential quarter of the city where Mr Aideed was believed to be in hiding. The assault achieved little but a massive loss of life.
"My mother and grandmother were praying the afternoon the Americans came in their helicopters and my brother was fixing a car," Mohamed, 20, says as he stands by three graves in the shade of a tree. "I thought the Americans had come to help us but instead they attacked my home and killed my family. If they come anywhere near this neighbourhood I will have my revenge."
The worst-case scenario envisaged by the US Marines is an outright assault on their troops. But the belief is that even if Mr Aideed, the warlord with the most grievances, wished to attack, he would be unable to because of the erosion of his clan powerbase over the past year.
Nevertheless, the port and nearby airport, which until the arrival of the US invasion force were controlled by Mr Aideed, remain of strategic political and economic importance.
Representatives of the main factions claim to have reached an agreement for their joint management, but few believe such a deal can work. The UN, not taking any chances, is removing all its equipment bar the odd table and chair. When the UN abandoned its compound in the centre of the city this month it was stripped bare by scavengers. Even if the main clans do not contest control of the port and airport, a frenzy of looting is expected.
Lieutenant-Colonel Jerry Broeckert, a spokesman for the coalition task force, said: "We'll do what we have to do to assure an orderly evacuation of the UN forces but we only want to come for a limited time, do our job and get out."
What life will be like in Mogadishu when the international forces withdraw is uncertain. One resident predicts: "First will come the season of looting, then the season of road blocks and then the season of clan fighting." The prospect of civil war will never be far away.Reuse content