 His older brother John had been killed in the 1857 uprising and William joined the service in 1860 after ranking third (of 160 applicants) in the entrance exam of 1859.His elder brother David was the 3rd baronet.He entered the Indian Civil Service in Bombay in 1860, served as District Judge and Judicial Commissioner in Sind; acted as secretary to Bombay Government, Judicial and Political Departments; and from 1885 acted as Judge of the High Court, Bombay.