Yamao was born in Aio-Futajima, a village in Chōshū domain, and received a traditional training as a Samurai. He was eager to learn science, and entered the Egawa School in Edo, then continued studying under Takeda Hishisaburo, a samurai engineer at Hakodate. In the end of 1862, he joined extremist group of Chōshū domain, and set fire to newly completed British Legation building on Gotenyama. Five of the young Choshu samurais, so called Chōshū Five soon left Japan for London from Nagasaki to study western knowledge in 1863 with help of Thomas Blake Glover.
Study in the Britain
Before being able to study at the University College London, the members of the Choshu Five studied English for a year. Two of his colleagues Itō Hirobumi and Inoue Kaoru returned to Japan to try and stop Chōshū domain going to war with the Western powers, but Yamao and two other remained and studied science and industry at University College London. After two years, Yamao moved to Glasgow to receive technical training at Napier's shipyard on the Clyde. He lived in the home of Colin Brown, a friend of Hugh Matheson, and attended evening classes at Anderson's College. Henry Dyer also attended at the college and said he has seen Yamao, although they did not become personally acquainted at that time. Brown remembered that Yamao worked hard everyday from early in the morning for future of Japan at Glasgow, and could not help calling Yamao "Real Hero" when he was informed that Yamao took a position of responsibility in the Meiji government by C.A. McVean.
Return to Japan
Soon after the Meiji Restoration took place, Yamao returned to Japan and joined the new Meiji government. He first took charge of the Yokosuka Shipyard and Yokohama Iron-works. Meanwhile, Edmund Morel, a chief engineer for railway construction, proposed the new government to found the Ministry of Public Works, and Ito Hirobumi and Yamao endeavoured to create the new ministry. As Morel emphasised importance of engineers education and Colin Alexander McVean advised Yamao to set up survey department, Yamao successfully added these two departments into the new ministry in September 1871. After Morel passed away in October 1871, Yamao had to find new advisor for establishment of the engineering college, and eventually contacted Hugh Matheson again through good offices of McVean. Matheson kindly arranged appointment of teaching staff for the college lead by Henry Dyer through his connection with Lewis Gordon - William Rankine - William Thomson. Before arriving to Japan in June 1873, Dyer arranged calendar and syllabus for the engineering college on the board, which was accepted by Yamao without any revision. Yamao successfully established the college, which was officially renamed the Imperial College of Engineering in 1877. He also set up a school for the blind and deaf and is said to have introduced the idea of sign language to Japan. Yamao was elevated to the rank of shishaku in the kazoku peerage system.
Colin Brown was Euing Lecturer of Music in the Andersonian College, and compiled "Songs of Scotland: New Symphonies and Accompaniments " together with J. Pittman, "Auld Langsyne" on page 21. Yamao has surely used to listen to this song at Colin Brown's home and it is possible that Yamao introduced Auld Lang Syne to Japan where it is called Hotaru no Hikari and is sung at high school graduation ceremonies.