11

Is there a way to update the emacs terminal editor that comes with OS X? I could remove the binaries and install Emacs using a dmg package, but the idea was to upgrade to a newer version with some command.

11

Apple controls when / if they update emacs so most people just install a newer version of the tool and change their PATH variable so the new version is found first and runs by default.

If you like the sound of that, I recommend installing Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install emacs:

brew install emacs

Add a link so that it'll work as emacs in the Terminal:

ln -s /usr/local/Cellar/emacs/24.5/Emacs.app /Applications

This will install the 'stable' version. As of this writing, that's 24.5:

» brew info emacs
emacs: stable 24.5 (bottled), devel 25.0-dev, HEAD
GNU Emacs text editor
https://www.gnu.org/software/emacs/

This is significantly newer (24.5.1) than the version that came with El Capitan (22.1.1):

» emacs --version
GNU Emacs 22.1.1
  • However doesn't this mean that typing emacs in Terminal will find the Apple supplied one first. Also you should explain why use Homebrew rather than a binary emacs and why you can't just copy that emacs over Apple's one – Mark Mar 3 '16 at 16:54
  • 2
    @Mark Because it's far more convenient than... really anything else. Testing whether it'll find the HB version first. – Undo Mar 3 '16 at 16:58
  • After testing it, there's one more command to link it. Edited, thank you. – Undo Mar 3 '16 at 17:01
  • surely you need more than that as you emacs in Applications is not on the path – Mark Mar 3 '16 at 17:08
  • The idea was not to install another emacs, since I've already the .app and the default one, and installing a new one would only be ridiculous...I really wanted to update the default one. – nbro Mar 3 '16 at 17:08
0

It could be done but best not to do it. Certain directories including /usr/bin are updated and controlled by Apple so any changes there will be removed when the OS is updated, also in El Capitan and above this path is locked down by SiP and so you have to go through more hoops to chnage files there.

$ ls -lO /usr/bin/emacs
-r-xr-xr-x  1 root  wheel  restricted,compressed 35581744 Jan 13 20:12 /usr/bin/emacs

However in practice there is no need to do this. Install a new emacs in places you have access to e.g. for command line in /usr/local/bin or ~/bin - or GUI versions in /Applications or ~/Applications. /usr/local/bin is the default path so in all cases you need to edit the path to put the directory containing emacs before /usr/bin.

-4

When using the brew command the correct command is brew upgrade emacs even if you have done a brew update, the install will install Emacs 25, the older version.

Just sharing my experience.

  • Could you bee a bit more specific in your question as to what you are doing, what you expect and what you get. – Tony Williams Jun 4 '18 at 2:15
  • Verified on macOS 11.13.6: brew upgrade emacs will fail if there is no brew-installed emacs available, brew install emacs will install the most recent version (emacs-26.1_1 right now). – nohillside Jun 4 '18 at 18:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .