He was born on New Year's Day 1826 at 28 Montrose Street in Glasgow, Scotland, the son of Dr. Harry Rainy LLD (1792-1876) a surgeon who later served as Professor of Forensic Medicine in the University of Glasgow, and his wife Barbara Gordon (1793-1854).