Of Scottish descent, MacGregor was born in Agra, India, the son of Major Robert Guthrie MacGregor of the Bengal Artillery. His grandfather was Major-General James MacGregor of the Bengal Cavalry. MacGregor was schooled at Marlborough College before returning to India at the age of 16 to join the Bengal Army. Arriving just in time for the Indian Rebellion of 1857, MacGregor fought in a number of actions, including at Lucknow and was wounded twice. MacGregor earned successive promotions whilst serving variously in campaigns in China, the Bhutan War and Abyssinia including at the Battle of Magdala. In the Second Afghan War MacGregor served as Quartermaster General on the Khyber communication lines and commanded the 3rd Brigade of the Kabul-Kandahar field force at the Battle of Kandahar. In the second phase of the Second Afghan War he became Commander Stewart's and Earl Roberts' chief of staff. After the Second Afghan War, training of men in intelligence gathering became the responsibility of the Quartermaster General and MacGregor served in this role for the East Indies until 1885. In 1870, MacGregor founded the United Service Institution of India for the "furtherance of interest and knowledge in the art, science and literature of the Defence Services." The Institution awards the MacGregor Medal, founded in his memory, in recognition of valuable contributions to military intelligence that are of defensive importance to India. MacGregor's The Defence of India attempted to alert the British public to the geo-strategic importance of India, and the threat posed to British interests by Russia. MacGregor was appointed Knight Commander of the Order of the Bath, Companion of the Order of the Star of India and Companion of the Order of the Indian Empire). He was promoted to Major General weeks before his death on 5 February 1887.
Family
In 1869, he married Frances Mary, daughter of Sir Henry Marion Durand; she died on 9 May 1873; they had one daughter. In February 1883, he married Charlotte Mary Jardine.
Works
Narrative of a journey through the province of Khorassan and on the n.w. frontier of Afghanistan in 1875, 1879