MacGillivray 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 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 PetrelPseudobulweria macgillivrayi.