Building Emacs 26 on macOS Mojave

1 minute read

Another, macOS (Mojave), another major Emacs release, let’s get building.

Ironically, I started this post in vi. Why? I’d updated brew and a change in the ImageMagik version broke Emacs.

The complexity of this exercise waxes and wanes as the dependencies of Emacs change and as the versions of tools Apple ships get old or get updated. This time around, there is one new requirement. Emacs has replaced OpenSSL with GnuTLS for making SSL connections, you’ll want to install it. With Homebrew is brew install gnutls. If you use another package manager, you know how to work it. Building that from scratch is left as an exercise for the reader.

Then there are the things you’ve needed for a while now.

Xcode free in the Mac App Store. If you don’t have this already why are you trying to compile Emacs?

Autoconf and Automake. The easiest way to install is Homebrew via brew install autoconf automake. If you use another package manager, you know how to work it. If you are all-in on building from source, check out the above guide for details.

makeinfo (part of the Texinfo suite). Apple ships makeinfo, but at some point, the system version fell below the minimum version Emacs needs to build. Once again, Homebrew is the easiest way with brew install texinfo.

However you get makeinfo, make sure that the path to your new version comes before /usr/bin where Apple has installed theirs. For the Homebrew version you’d want:

export PATH="/usr/local/opt/texinfo/bin:$PATH"

Now that you have what you need, grab the source:

git clone git://git.savannah.gnu.org/emacs.git
cd emacs

Checkout the emacs-26 branch (master is the development branch):

git checkout emacs-26

One last bit of housekeeping. Emacs 26 uses Libxml2 to parse XML. The library is included with Xcode, but the Emacs build process can’t find it. Give it a hint with:

export LIBXML2_CFLAGS=`xml2-config --cflags`
export LIBXML2_LIBS=`xml2-config --libs`

Now you’re ready to configure and build:

make configure
./configure --with-ns
make install

As always, the make install step doesn’t actually install anything, it’s used to create the App bundle after building Emacs.

Test it:

open nextstep/Emacs.app

If it looks good, reveal it in the Finder

open -R nextstep/Emacs.app

drag Emacs to the Applications folder and you’re good to go!

Comments