Born in Georgetown, then a separate municipality in the District of Columbia, Cox received a Bachelor of Arts degree from Georgetown University in 1843, a Master of Arts degree from the same institution in 1844, and a Bachelor of Laws from Harvard Law School in 1847.
He was in private practice in Washington, D.C. from 1848 to 1879, and during that period was also a recorder for the City of Georgetown, an Alderman for the City of Georgetown, and an auditor of the Supreme Court of the District of Columbia.
From 1874 to 1879, he was a Professor of law at what was then called Columbian University, known today as George Washington University in Washington, D.C.[1] On April 16, 1868, Cox testified in the impeachment trial of President Andrew Johnson, having been called as a witness by Johnson's defense team.
He was confirmed by the United States Senate on March 1, 1879, and received his commission the same day.
Following his retirement from the federal bench, Cox resumed teaching as a Professor of law at George Washington University from 1899 to 1902.