he went to school at edinburgh institution (now known as stewart's melville) and in 1835 was apprenticed to be a solicitor with his uncle, alexander gifford ssc at 2 hill square on the south side of the city. he then studied law at the university of edinburgh and was called to the bar as an advocate in 1849.