How can I install emacs correctly on OS X?
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.
This is an update for April 2019, Mac OSX mojave 10.14.4 discussion on reddit
It seems that the cocoa option is not available on hombrew also the --head. So you can:
brew cask install emacs #is the preferred from emacs wiki
brew install --cask emacs #using new cask syntax
and if you want to do the equal setup from brew without using cask, you can use this:
emacs-head
brew tap daviderestivo/emacs-head
brew install emacs-head --HEAD --with-cocoa --with-librsvg --with-imagemagick@7 --with-jansson --with-multicolor-fonts --with-no-frame-refocus --with-mailutils --with-dbus --with-modules
getting this
ls -l $(which emacs)
lrwxr-xr-x 1 toni admin 45 23 abr 19:26 /usr/local/bin/emacs -> ../Cellar/emacs-head/HEAD-259dfd2_1/bin/emacs
Then you can make it and osascript to get in spotlight and applications:
osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/Cellar/emacs-head/HEAD-259dfd2_1/Emacs.app" at POSIX file "/Applications"'
This is obsolete from now but it contains further information: This is an update for October 2017. Now the easy to install emacs is using brew cask
brew cask install emacs
With this, it works well but I have an issue with gnutls and installing last org (9.1.6), but it worked well
for the traditional way and getting an emacs more integrated with your system or the nightly releases you can install with
brew install emacs --HEAD --with-cocoa --with-gnutls --with-librsvg --with-imagemagick@6 --with-mailutils
the --HEAD is not necessary, and now (23-01-2018) get Emacs 27, for the latest distributed without HEAD
then you should make this to use spotlight:
brew linkapps emacs
rm /Applications/Emacs.app
osascript -e 'tell application "Finder" to make alias file to POSIX file "/usr/local/opt/emacs/Emacs.app" at POSIX file "/Applications"'
and finally take a look at emacs wiki
Homebrew has Emacs 25.3 as of October 2017. Cask homebrew installation
Homebrew now recommends to use the cask version with the following message: “Please try the Cask for a better-supported Cocoa version”
To install the cask version:
brew cask install emacs
This installs a pre-built package from https://emacsformacosx.com/ Standard homebrew installation
If you prefer not to run the cask version, you can still use the old homebrew recipe.
A Cocoa-specific Emacs.app can be built using the --with-cocoa switch. A version supporting X11 can be built using the --with-x switch. Note that this version will not have all of the features of the Cocoa
version; use only if necessary.
Other options include:
--keep-ctags Don’t remove the ctags executable that emacs provides. Use of this flag is not recommended Instead, use brew
install ctags after installation. --srgb This option will enable sRGB colors when using Cocoa.
To install using the --with-cocoa switch, one simply uses:
brew install --with-cocoa emacs
to get some “pretty” colours add the --srgb switch:
brew install --with-cocoa --srgb emacs
and finally link it to your Applications folder:
brew linkapps emacs
This creates a symlink and not an alias. So Spotlight may not find it (tested on macOS Sierra 10.12.2). Spotlight indexes symlinks to files that are treated as system files, but it doesn’t show them in the GUI. It does show aliases though, so you could just command-option-drag /usr/local/Cellar/emacs/*/Emacs.app to /Applications/ from Finder. Or:
$ osascript -e "tell application "Finder" to make alias file to (POSIX file "/usr/local/Cellar/emacs-plus/25.3/Emacs.app") at POSIX file "$HOME/Applications""
After installation, using the emacs command in the terminal or shell will run the -nw version of Emacs. If you want to run the Cocoa version using this command, you simply add a line to your .bash_profile. Emacs-Plus version in tap
To instead use the emacs-plus version, which is like regular homebrew emacs but with some configuration options enabled,
brew tap d12frosted/emacs-plus brew install emacs-plus
Mitsaharu version in tap
To instead use the Yamamoto Mitsuharu version of Emacs 25.2 (with more mac-specific features):
brew tap railwaycat/emacsmacport brew install emacs-mac
and finally link it to your Applications folder:
brew linkapps emacs-mac
Actually, I don't know why we should do like other answers, why this post answers are complex? for installing emacs
on Mac OSX just run below command in Mac terminal:
brew install --cask emacs
Then you have the latest version. just it.