Nasmyth was born at 47 York Place, Edinburgh where his father Alexander Nasmyth was a landscape and portrait painter. One of Alexander's hobbies was mechanics and he employed nearly all his spare time in his workshop where he encouraged his youngest son to work with him in all sorts of materials. James was sent to the Royal High School where he had as a friend, Jimmy Patterson, the son of a local iron founder. Being already interested in mechanics he spent much of his time at the foundry and there he gradually learned to work and turn in wood, brass, iron, and steel. In 1820 he left the High School and again made great use of his father's workshop where at the age of 17, he made his first steam engine.