Installing Emacs from Source (macOS 10.14)

December 17, 2019

Infor­ma­tion about installing Emacs from source on macOS seems to be sur­pris­ing­ly sparse, so putting it all here togeth­er for easy ref­er­ence. If it mat­ters, the Emacs ver­sion I installed was 27.0.50, on macOS 10.14.

  1. Pick from either git://git.sv.gnu.org/emacs.git or git@github.com:emacs-mirror/emacs.git (or have both as dif­fer­ent remotes).
  2. Install texinfo, gnutls, and make sure you have Com­mand Line Tools installed xcode-select --install. Addi­tion­al­ly, you need the SDK head­ers.
  3. Run ./autogen.sh, then ./configure (with any other flags you may want, I have --with-modules for vterm sup­port), then final­ly make install, which will com­pile it into an appli­ca­tion binary for your perusal.
brew install texinfo
echo 'export PATH="/usr/local/opt/texinfo/bin:$PATH"' >> ~/.zshrc # or follow the instructions given by brew info
brew install gnutls
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
git clone git://git.sv.gnu.org/emacs.git
cd emacs
./autogen.sh
./configure --with-modules # flag optional
make install # takes some time, grab caffeinated beverage of choice

Var­i­ous error mes­sages that you may encounter:

checking for makeinfo... /usr/bin/makeinfo
configure: error: You do not seem to have makeinfo >= 4.13, and your
source tree does not seem to have pre-built manuals in the 'info' directory.
Either install a suitable version of makeinfo, or re-run configure
with the '--without-makeinfo' option to build without the manuals.

You’re miss­ing makeinfo/texinfo.

xml.c:23:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^
1 error generated.
make[1]: *** [xml.o] Error 1
make: *** [src] Error 2

You need to install the SDK head­ers as above.