After participating in the U.S.-Mexican War defending his country as a volunteer, he studied medicine in Paris (1847–1851). There he became acquainted with Auguste Comte's doctrine, before his first publications in philosophy. Upon returning to Mexico City, he introduced the positivistic school, and taught in Guanajuato (1863–67) until the end of the Maximilian empire. Later he met Education minister Antonio Martínez de Castro, who named him teacher of Logic at the National Preparatory School, where he worked for several years. In 1878 he was received in Berlin as Mexican ambassador in the German Empire. He influenced many traditionalist thinkers during the Porfirian regime.
To this day, he is acknowledged as one of the fathers of the UNAM and the undergraduate medal for the top student of each major's class is named in his honor.