MacGillivray was born in Aberdeen, the son of ornithologist William MacGillivray. He took part in three of the Royal Navy's surveying voyages in the Pacific. In 1842 he sailed as naturalist on board HMS ''Fly'', despatched to survey the Torres Strait, New Guinea, and the east coast of Australia, returning to England in 1846.
In the same year he was appointed as naturalist on the voyages of HMS ''Rattlesnake'' (Captain Owen Stanley), collecting in Australian waters at Port Curtis, Rockingham Bay, Port Molle, Cape York, Gould Island, Lizard Island and Moreton Island in Queensland, Port Essington (Northern Territory) and visiting Sydney (New South Wales) on several occasions. The expedition was in Hobart, Tasmania, in June 1847 and also surveyed in Bass Strait, and on the southern coast of New Guinea and the Louisiade Archipelago. On this series of voyages his most notable achievement was to make records of the aboriginal languages of the peoples he encountered. His account of the voyages was published in London.
In 1852 he deserted his sick wife and his children in London, and sailed for Australia. T.H. Huxley found his consumptive wife down to her last shilling, and raised £50 to send her and the children back to Australia where her parents could look after her. She died two weeks from Sydney (Desmond 1994 p217).
MacGilllivray's journey on HMS ''Herald'' was also doomed to failure. The ship visited Lord Howe Island, New South Wales, Dirk Hartog Island and Shark Bay, Western Australia. On this expedition he was accompanied by Scots naturalist William Grant Milne. MacGillivray left the voyage early in 1855, having been dismissed by the captain Henry Mangles Denham. He had become a hopeless drunkard, and when he died, alone in a squalid hotel room, the records noted 'mother and father unknown' (Desmond 1994).
MacGillivray died in Sydney, New South Wales, on 6 June 1867.
He is commemorated in the name of the Fiji Petrel Pseudobulweria macgillivrayi.
He also collected a specimen of venomous elapid snake on the northeastern coast of Australia. It was described by zoologist Albert Günther in 1858 as Glyphodon tristis but it is now called Furina tristis. In 1898 the eminent Australian herpetologist Edgar Waite referred to this snake as MacGillivray's snake Waite, E.R.. 1898 A Popular Account of Australian Snakes: with a complete list of the species and an introduction to their habits and organization. Thomas Shine, Sydney pp.71. but this name has now fallen into disuse and it is now known as either the Brown-headed snake or the Grey-naped snake.