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.
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
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.
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.