He then studied Philosophy at Glasgow University (graduating Master of Arts in 1861) and began a legal apprenticeship with Robert Lamond before moving to Edinburgh to study Scots Law and Civil Law, graduating Bachelor of Laws. He then studied further at Heidelberg University before being appointed to the Scottish Bar.
He was also a Commissioner of the Northern Lighthouse Board. He became an advocate in 1864. He rose to be Sheriff of Dumfries and Galloway in 1890 and from 1896 was Sheriff of Roxburgh, Berwick and Selkirk.
He was Chairman of the Edinburgh Street Tramways Association and a Commissioner of the Northern Lighthouse Board.
He was elected a Fellow of the Royal Society of Edinburgh in 1898, his proposers including Sir Stair Agnew. He died at home, 37 Moray Place in Edinburgh, at 10am on 10 November 1901, ten days after catching a chill whilst attending a wedding in Peebles.
He is buried in Dean Cemetery in western Edinburgh. The grave lies facing the southern path of the northern Victorian extension.
She is buried with him.
In 1886 he unsuccessfully stood as a Member of Parliament for the Glasgow College constituency, losing to Sir Charles Cameron.