Recently I removed the Homebrew completely on my OS X 10.7.4 (because the only reason I was using it was the OpenSSL package and I installed it from scratch into /usr/localand it worked perfectly so there was no need to keep a large /usr/local/Cellar folder)

Then when I started Emacs-25.2.1 (as a precompiled app in /Applications/Emacs-25.2.app) it gave

Dyld Error Message:
  Library not loaded: /usr/local/lib/libMagickWand-6.Q16.1.dylib
  Referenced from: /Applications/Emacs-25.2.app/Contents/MacOS/Emacs
  Reason: image not found

and the Emacs windows didn't come up.

I've noticed one of the dependencies of Emacs /usr/local/lib/libMagickWand-6.Q16.1.dylib was symlinking to /usr/local/Cellar/imagemagick/6.8.7-7/libd/libMagickCore-6.Q16.1.dylib So I've installed ImageMagick-7.0.8-60 from scratch and rearranged the symlink into this new one and repeated the same for the other Dyld Error causing MagickCore and finally Emacs started to come up and work fine but it wasn't displaying the jpg and png images.

I've checked the libjpeg dependency path and it is /usr/local/lib/libjpeg.8.dylib (compatibility version 12.0.0, current version 12.0.0) But the libjpeg.8.dylib was already available at /usr/local/lib so I've installed the libjpeg-8c, 8d, 9c and retried but it didn't display any jpeg images. I guess I got stuck at this point.

How to fix this problem? Thanks.


$ otool -L /Applications/Emacs-25.2.app/Contents/MacOS/Emacs
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1138.47.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /usr/local/lib/libjpeg.8.dylib (compatibility version 12.0.0, current version 12.0.0)
    /usr/local/lib/libMagickWand-6.Q16.1.dylib (compatibility version 2.0.0, current version 2.0.0)
    /usr/local/lib/libMagickCore-6.Q16.1.dylib (compatibility version 2.0.0, current version 2.0.0)
    /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
    /usr/local/lib/libncurses.5.dylib (compatibility version 5.0.0, current version 5.0.0)
    /usr/local/lib/libgnutls.30.dylib (compatibility version 37.0.0, current version 37.1.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 41.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 833.25.0)
  • Where did you get that Emacs from? – nega Aug 17 '19 at 13:44
  • It was from emacsformacosx.com i.e. plain and pure build for OS X. – Romario Aug 17 '19 at 18:38
  • @nega I've attached an otool output showing all dependencies of Emacs-25.2. – Romario Aug 17 '19 at 18:43
  • Did you overwrite that Emacs with another one? A fresh download of emacsformacosx.com/emacs-builds/Emacs-25.2-universal.dmg has /Applications/Emacs-25.2.app/Contents/MacOS/Emacs as a Ruby script, and none of the four binaries are dynamically linked to libjpeg. Try moving your Emacs aside, and downloading a fresh copy. – nega Aug 19 '19 at 14:12
  • Coincidentally, today afternoon I've done exactly that downloaded Emacs-25.2-universal.dmg and tried it. But when I clicked on it it didn't even start, the Emacs icon on the dock bounced for tens of seconds and Emacs didn't ever start up. Then I have tried compiling Emacs-25.2 from sources up with /configure --prefix=/usr/local/emacs-25.2 --with-ns but it said checking AppKit/AppKit.h presence... yes checking AppKit/AppKit.h usability... no then stoped with configure: error: (AppKit/AppKit.h etc) that are required for a Nextstep build are missing or cannot be compiled. – Romario Aug 19 '19 at 15:02

It sounds like your Emacs app has been overwritten. If you've already removed Homebrew, remove all references to emacs from /usr/local. Then remove /Applications/Emacs.app and/or ~/Applications/Emacs.app. Remove the icons from Launchpad and the app bar. During this process take care not to remove bits of macOS's default Emacs (version 22.1.1) from /usr. In your terminal, check your path with which emacs. The default /usr/bin/emacs should be the response. In your terminal check with open. open -a Emacs should fail. If not, there's an Emacs.app somewhere on you computer that macOS can still find. Get rid of it.

At this point we should be mostly clean, or clean enough. Download your preferred version of Emacs from http://emacsforosx.com. Open the .dmg. Drag the Emacs icon on to the Applications icon. Give it a minute to do its thing. Unmount the .dmg file by dragging the Emacs "drive" to the trash, or right-clicking it and selecting Eject.

At this point we have a fresh Emacs app bundle installed at /Applications/Emacs.app. Running open -a Emacs or clicking /Applications/Emacs in Finder should start Emacs.

If Emacs doesn't start, in your terminal run /Applications/Emacs.app/Contents/MacOS/Emacs. (That's what open -a or clicking via Finder essentially does.) In the package provided http://emacsforosx.com this is a Ruby script. If you get a "bad interpreter" error, there's a problem with your local Ruby. Fix that and things should work again. Other errors may indicate an incompatiblity between your Emacs version and your macOS version. Address those as needed. As a last resort if one of the version specific binaries works for you, say for example Emacs-x86_64-10_7 you can always symlink that to /Applications/Emacs.app/Contents/MacOS/Emacs so that Find and open -a will work. Again, that would be a last resort.

| improve this answer | |
  • Thank you for the answer. After doing all those checks, the problem seemed to be caused by a combination of the damaged /Application/Emacs-25.2 and bad Ruby interpreter. Homebrew's uninstall script must have removed the Ruby interpreter causing the normally working Emacs.app not to work and I myself must have damaged the /Application/Emacs-25.2 as I was trying in a hurry different versions of Emacs.I don't exactly remember which actions I took, I have even sent it to trash folder and taken it back again. At the end, it's good to see the fully functioning Emacs-25.2 again :) – Romario Aug 19 '19 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.