keir was born in stirlingshire, scotland, in 1735 as the eighteenth child of john and magdaline keir. james attended the royal high school, edinburgh, and studied medicine at the university of edinburgh where he met and formed a lasting friendship with erasmus darwin.