Search code examples
macosemacs

How can I install emacs correctly on OS X?


I tried doing:

brew install emacs --HEAD --use-git-head --with-cocoa --with-gnutls --with-rsvg --with-imagemagick

But when I do emacs --version

emacs --version
-bash: /usr/local/Cellar/emacs/24.5/Emacs.app/Contents/MacOS/Emacs: No such file or directory

When I do

brew info emacs

emacs: stable 25.2 (bottled), HEAD

I am an EMACS newbie. It's a bit difficult to understand. And I may have deleted the default Emacs


Solution

  • You don't need some of those arguments your passing to brew to get the latest emacs 26.1. Try the following

    Remove emacs

    brew uninstall emacs
    

    Clean out any previously downloaded source files

    brew cleanup
    

    Check your brew installation is OK

    brew doctor
    

    The message you get when you run emacs --version indicates a partially installed version of emacs 24. Running brew doctor should help identify the problems.

    Make sure your running the most recent brew

    brew update
    

    Upgrade any brew stuff you have in case any of them are pre-requisites

    brew upgrade
    

    then install emacs with

    brew install emacs --with-cocoa --with-librsvg --with-imagemagick@6
    

    Watch for messages from brew. During the install, brew use to advise running

    brew linkapps emacs
    

    afterwards to make sure the new version is linked to the /Applications folder correctly. I suspect this may have been the missing step in your install. While the brew manual suggests this command is deprecated, it also says to use a cask version instead. I found some issues with the cask version, so prefer to use the locally built vers (cask version uses emacsforosx binaries). It isn't clear if you should still run linkapps when using the non cask version - however, the install should tell you, so make sure you look at all the output (the message is not at the end, but further up in the install process output).

    The other arguments you had are only necessary if you want to install the latest development version, which is not a good idea if your just starting out. all you want is emacs 26.1

    Make sure that /usr/local/bin is in your path before /usr/bin to avoid emacs referencing the very old version of Emacs bundled with OSX.