He attended Milnathort Parish School then the High School in Edinburgh.
He studied law in Edinburgh though later became a botanist, holding the position of Regius Professor of Botany in the University of Glasgow from 1845 to 1868. He studied the botany of North America with Sir William Hooker and collaborated with Robert Wight in studies of Indian botany. He died in Glasgow and is buried in Lighthill Cemetery.
He was a member of the Societe de Histoire Narurelle in Paris and the Moscow Imperial Society of Natural History.