Sir William Macgregor, 2nd Baronet (1817 – 29 March 1846) was a British Army officer.
The eldest son of the physician Sir Patrick Macgregor, 1st Baronet, he succeeded him in his baronetcy in 1828.[1] On 20 March 1835, he purchased an ensigncy in the 18th Regiment of Foot. On 29 March 1839, he purchased a lieutenancy in the regiment.
Macgregor fought in the First Opium War, and fell ill from sunstroke at the Battle of Chinkiang. He was promoted captain shortly thereafter, on 22 July, to replace Captain Collinson, killed at the battle. He later returned to China overland before fully recovering from his sunstroke, to which cause his death was attributed. On 19 April 1844, he exchanged into the 92nd Regiment of Foot.
Macgregor died at Gibraltar in 1846. He was attended by his brother-in-law, the Rev. Joseph Sortain.[2]