Exhibit 5.1 November 21, 2007 MacroChem Corporation 40 Washington Street, Suite 220 Wellesley Hills, MA 02481 Re: Registration Statement on Form S-1 Ladies and Gentlemen: This opinion is furnished to you in connection with a registration statement on Form S-1 (the 'Registration Statement'), filed today with the Securities and Exchange Commission under the Securities Act of 1933, as amended, for the registration of shares of Common Stock, $.01 par value (the 'Common Stock'), of MacroChem Corporation, a Delaware corporation (the 'Company'), comprised of (i) 5,891,666 shares of Common Stock (the 'Issued Shares') and (ii) 13,984,044 shares of Common Stock (the 'Warrant Shares') issuable upon the exercise of warrants (the 'Warrants'). The Issued Shares and the Warrant Shares are referred to collectively herein as the 'Registrable Securities.' Please be advised that as counsel to the Company, upon examination of such corporate documents and records as we have deemed necessary or advisable for the purposes of this opinion, it is our opinion that the Registrable Securities included in the Registration Statement are duly authorized and that they are or will be upon issuance in accordance with their applicable documents and instruments, legally and validly issued, fully paid and nonassessable. We have assumed that no issuance of the Warrant Shares will result in the issuance by the Company of shares in excess of its authorized Common Stock and that the price received by the Company for the Warrant Shares issued upon exercise of the Warrants will not be less than the par value thereof. We understand the Registrable Securities are being registered to permit the resale of such Common Stock by the holders thereof from time to time after the effective date of the Registration Statement. The remaining shares covered by the Prospectus filed today with Registration Statement were originally registered on the Form S-1 filed with the Securities and Exchange Commission on March 30, 2006, which was declared effective on April 18, 2006 and subsequently amended by post-effective amendment on April 30, 2007 (the 'Prior Registration Statement'). Upon being declared effective, the Registration Statement will act as a post-effective amendment to the Prior Registration Statement. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement, and to the reference to our firm under the hearing 'Legal Matters' in the prospectus comprising a part of the Registration Statement. We express no opinion as to the applicability of, compliance with, or effect of federal law or the law of any jurisdiction other than the General Corporation Law of the State of Delaware. It is understood that this opinion is to be used only in connection with the offer and sale of the Registrable Securities while the Registration Statement is in effect. Very truly yours, /s/ Ropes & Gray LLP Ropes & Gray LLP