EXHIBIT 5.1 April 30, 2007 MacroChem Corporation 40 Washington Street, Suite 220 Wellesley Hills, MA 02481 Ladies and Gentlemen: This opinion is furnished to you in connection with a registration statement on Form S-8 (the "Registration Statement"), filed with the Securities and Exchange Commission under the Securities Act of 1933, as amended, for the registration of an aggregate of 2,302,142 shares of Common Stock, $0.01 par value (the "SHARES"), of MacroChem Corporation, a Delaware corporation (the "COMPANY"), of which: (i) 1,345,238 are issuable under the Company's 2001 Incentive Plan (the "PLAN"); (ii) 11,904 are issuable upon the exercise of that certain stock option awarded to Robert J. DeLuccia on June 20, 2003 as an inducement to his accepting employment with the Company; (iii) 45,000 are issuable upon the exercise of that certain stock option awarded to John L. Zabriskie on February 10, 2006 in connection with his service as a director of the Company; (iv) 45,000 are issuable upon the exercise of that certain stock option awarded to Michael A. Davis on February 10, 2006 in connection with his service as a director of the Company; (v) 45,000 are issuable upon the exercise of that certain stock option awarded to Jeffrey B. Davis on February 10, 2006 in connection with his service as a director of the Company; (vi) 45,000 are issuable upon the exercise of that certain stock option awarded to Howard S. Fischer on February 10, 2006 in connection with his service as a director of the Company; (vii) 45,000 are issuable upon the exercise of that certain stock option awarded to Paul S. Echenberg on February 10, 2006 in connection with his service as a director of the Company; S-5 (viii) 45,000 are issuable upon the exercise of that certain stock option awarded to Peter G. Martin on February 10, 2006 in connection with his service as a director of the Company; (ix) 350,000 are issuable upon the exercise of that certain stock option awarded to Robert J. DeLuccia on February 10, 2006 in connection with his service as an executive officer of the Company; (x) 175,000 are issuable upon the exercise of that certain stock option awarded to Bernard R. Patriacca on February 10, 2006 in connection with his service as an executive officer of the Company; and (xi) 150,000 are issuable upon the exercise of that certain stock option awarded to Glenn E. Deegan on February 10, 2006 in connection with his service as an executive officer of the Company. The option certificates pursuant to which the options in items (ii) through (xi) above were issued are referred to herein as the "OPTION CERTIFICATES". We are familiar with the actions taken by the Company in connection with the adoption of the Plan and the Option Certificates. For purposes of our opinion, we have examined and relied upon such documents, records, certificates and other instruments as we have deemed necessary. The opinions expressed below are limited to the Delaware General Corporation Law, including the applicable provisions of the Delaware Constitution and the reported cases interpreting those laws. Based on the foregoing, we are of the opinion that the Shares have been duly authorized and, when the Shares have been issued and sold in accordance with the terms of the Plan and the Option Certificates, the Shares will be validly issued, fully paid and nonassessable. We hereby consent to the filing of this opinion as an exhibit to the Registration Statement. Our consent shall not be deemed an admission that we are experts whose consent is required under Section 7 of the Securities Act of 1933. It is understood that this opinion is to be used only in connection with the offer and sale of Shares while the Registration Statement is in effect. Very truly yours, /s/ Ropes & Gray LLP Ropes & Gray LLP S-6