He graduated from the United States Military Academy in 1839 as a brevet second lieutenant in the 2nd U.S. Artillery. He served in the Mexican War under Winfield Scott, and was appointed a brevet captain for gallantry at Contreras and Churubusco and to major at Chapultepec. Hunt was a veteran member of the Aztec Club of 1847 and a First Class Companion of the Military Order of the Loyal Legion of the United States which were military societies of United States officers who had served in the Mexican War and Civil War respectively.