Cobb graduated at Harvard in 1766 and later he studied medicine in Boston.
Cobb practised the law at Taunton. In the opening scenes of the Revolution, he was secretary of the Bristol County convention, member of the General Court, and of the provincial congress. Serving for a while as surgeon of a Massachusetts regiment, he became on January 12, 1777, lieutenant-colonel of Henry Jackson’s regiment; he was promoted to be colonel, was appointed to the 5th Massachusetts, January 7, 1783, and was made brevet brigadier-general on September 30, 1783. During the last two years of the war he was one of Washington’s aides. In this capacity he had the honor of going to meet Rochambeau with letters from the Commander-in-Chief in June 1781, and of treating with Sir Guy Carleton in regard to the evacuation of New York in 1783. His active service ended in November of that year, though he was made major-general of militia in 1786.
After the war he held a number of public offices. During his term as judge of the court of common pleas in Bristol County, Shays’s Rebellion broke out. Attacks on court-houses were made by mobs, in Taunton as in other towns, and Cobb’s attitude was pronounced. It is reported that he said, “I will hold this court if I hold it in blood; I will sit as a judge, or I will die as a general”; and again, drawing a line as he placed a field-piece in front of the court-house, he said, “If you want these papers you must come and take them, but I will fire on the first man that crosses the line”. Cobb was speaker of the Massachusetts House of Representatives, 1789-1793, and a Federalist member of Congress, 1793-1795. Removing to Maine, then a part of Massachusetts, he settled as a farmer in Gouldsboro, and promoted the opening of lands for colonists from Massachusetts. He continued to be active in politics; president of the state Senate, 1802-1805; lieutenant-governor 1809; and member of the Board of Military Defence in 1812. His last judicial office was that of chief justice of Hancock County.
Cobb was a member of the Federalist Party.
Cobb was married to Eleanor Bradish.