'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 1:[1]
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.
Solution 2:[2]
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:
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
Solution 3:[3]
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.
Solution 4:[4]
2022 update:
brew install homebrew/cask/emacs
Is the best way to install emacs on mac now.
Previous answer:
You should be able to get yourself back to a sane state with brew uninstall emacs
and brew cleanup
.
Since brew and cask joined, now you can brew install --cask emacs
. ?
Assuming you want the GUI installed as well.
Solution 5:[5]
Using brew
:
brew install --cask emacs
Credit goes to @Mark McElroy.
Previous Answer:
I would install Emacs from https://emacsformacos.com/
and create /usr/local/bin/emacs
with:
#!/bin/sh
exec /Applications/Emacs.app/Contents/MacOS/Emacs "$@"
Finally run:
chmod 755 /usr/local/bin/emacs
You can now run emacs
from the command-line.
Solution 6:[6]
To install emacs using the Mac terminal use command "brew install emacs" ONLY if home-brew is already installed. Otherwise install home-brew first using command /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)". Once home-brew is installed then you can use previous emacs command. After emacs is installed you can run brew services start emacs to successfully start emacs.
Solution 7:[7]
I just uninstalled and reinstalled with
brew cask install emacs
Works ok. Unless you use org-mode.
Go into /Applications/Emacs.app/Contents/Resources/lisp/org
and take a look at org.el.gz
The very outdated Version 9.1.9.
What is very confusing is that he Org menu says the version is 9.3.7 and (org-version) reports the same.
Do a packages-list-packages and it correctly reports 9.1.9.
Guess how much of my time was wasted on this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Andreas |
Solution 2 | Community |
Solution 3 | furins |
Solution 4 | |
Solution 5 | |
Solution 6 | Bul |
Solution 7 | Gene De Lisa |