In 1847, while serving on the ship in the Gulf of Mexico and on the Pacific coast during the Mexican War, he took part in the siege and capture of Vera Cruz and in the capture of Tuxpan, and in 1848, while the navy was in occupation of Mazatlán, he commanded one of the forts.