He was educated at the grammar school of Haddington, and at the University of Edinburgh, where he attended the law lectures of John Erskine of Carnock.
He was appointed one of the commissioners for collecting evidence in the Douglas case, and in that capacity accompanied James Burnett to France in September 1764. He was the leading advocate in the Scottish court of exchequer for many years. He became a Lord of Session on 14 November 1782, succeeding Alexander Boswell, Lord Auchinleck, and a Lord of Justiciary on 20 April 1785, taking the judicial title Lord Eskgrove (from a small estate which he possessed near Inveresk), in place of Robert Bruce of Kennet.
Rae was one of the judges who tried William Brodie (died 1788) for robbing the General Excise Office in August 1788, the Review
Thomas Fyshe Palmer for seditious practices in September 1793, William Skirving and Maurice Margarot for sedition in January 1794, Joseph Gerrald for sedition in March 1794, and Robert Watt and David Downie for high treason in September 1794. He was appointed Lord Justice Clerk on 1 June 1799, in place of Robert Macqueen, Lord Braxfield, holding office until his death.
He was created a baronet on 27 June 1804. He died on 23 October the same year, and was interred in Inveresk Kirkyard.
He has a relatively modest stone on the south side of the church itself (Street Michael"s) just to the left hand side of the south door.
Rae is remembered by Lord Henry Cockburn in his book Memorials of His Time (published posthumously in 1856), as a “considerable lawyer” who became a deplorable judge, and Cockburn concludes “a more ludicrous personage could not exist.”
David, who succeeded as the second baronet, but died without male issue on 22 May 1815. William (1769–1842) called to the bar in 1791, Office of Lord Advocate of Scotland from 1827 to 1830 (presiding judge at the trial of Burke & Hare on 24 December 1828 in Edinburgh). Then M.P for Anstruther burghs between 1819 and 1826, then as M.P for Buteshire in 1830.
Between 1831 and 1832 he was M.P for Portarlington, then returned to Buteshire as Member of Parliament between 1833 and 1842.
He died at Street Catherine"s House (Liberton, Edinburgh) in 1842. and
Margaret, who married, on 3 January 1804, Captain Thomas Phipps Howard of the 23rd Light Dragoons.
He was admitted a member of the Faculty of Advocates on 11 December 1751, and quickly acquired a practice.