Build Terminal Emacs from source on macOS

I’m currently running Emacs 29 on macOS’s Terminal.app, built from source without a window system.

GNU Emacs 29.0.60
Development version 679f528b953a on emacs-29 branch; build date 2023-03-10.

My current version was build with the following system-configuration-features:

"ACL GMP GNUTLS JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE PDUMPER SQLITE3 THREADS TREE_SITTER XIM ZLIB"

Build & install

First, clone Emacs from Savannah’s git repository to ~/emacs. By selecting emacs-29 through the --branch flag, git automatically fetches the branch for the upcoming Erlang 29 release:

git clone --branch emacs-29 https://git.savannah.gnu.org/git/emacs.git ~/emacs

After switching to the ~/emacs directory, run autogen.sh to generate the configure script:

./autogen.sh

Then, run the newly-generated ./configure with the following options1:

--without-ns
Without NextStep (or AppKit) support, needed to build a graphical user interface.
--without-x
No X window support either, which is used as a fallback.
--with-native-compilation
Compile with the Emacs Lisp native compiler
--with-tree-sitter
By default, tree-sitter support is enabled only if the dependency is installed. Turning it on explicitly makes the configuration raise an error when tee-sitter isn’t installed.
./configure --without-x --without-ns --with-native-compilation --with-tree-sitter

Then, run make:

make

Update

If the repository was checked out previously and you don’t want to update the configuration flags, upgrade the installed version of Emacs by switching to ~/emacs, pulling in recent changes, running make and make install:

cd ~/emacs
git checkout emacs-29
git pull origin emacs-29
make
sudo make install

  1. Find more configuration options with .

    ↩︎