Skip to content

Instantly share code, notes, and snippets.

@zentrope
Last active June 10, 2018 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zentrope/b69e359b9bc1f86b0760e5df7f875552 to your computer and use it in GitHub Desktop.
Save zentrope/b69e359b9bc1f86b0760e5df7f875552 to your computer and use it in GitHub Desktop.
Build emacs on macOS

Build emacs on macOS

Build from scratch because most of the packages you use have updated to the nearly-completed next version, so why not pull that?

An alternative is to use home brew HEAD, but this is more fun.

Xcode

Probably should have Xcode installed, but at least try:

$ xcode-select --install

to get the command line tools. Homebrew will probably insist on this, too. If you see a libxml2 error, this might be way.

Get the Source

Check out the official repo:

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

If you want a branch:

$ git checkout emacs-26

Homebrew for prerequisites

Install this stuff via Homebrew:

$ brew install make automake texinfo gnutls libxml2 imagemagick

Initial make

Add to your path before building:

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

Fish shell version:

$ set -gx PATH /usr/local/opt/texinfo/bin $PATH

Then:

$ make configure
$ ./configure --build=x86_64-apple-darwin --without-dbus --with-ns CFLAGS="-I /usr/local/Cellar/libxml2/2.9.7/include/libxml2"
$ gmake install
$ cp -r nextstep/Emacs.app /Applications

Note the CFLAGS thing above.

gmake is the homebrew installed version of make. Regular make works, too.

Also note, that you probably don't need the -- flags in ./configure. I think they're the defaults.

Troubleshooting

Fails due to missing LIBXML include

Make sure the include path is viable in the above ./configure command. For instance, after a Homebrew update.

Daily Fetch

Just:

$ git fetch
$ git log HEAD..FETCH_HEAD --pretty=format:"%C(auto)%h %C(auto)%d %s (%C(cyan)%aE)" --graph
$ git merge
$ gmake install
$ cp -r nextstep/Emacs.app /Applications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment