Boško Ivanišević
Developer, Theoretical Physicist
Ruby, JavaScript, Elixir, C++ and few more

Building Emacs on OS X


There are a lot of ways to install plain Emacs on OS X. Just to list a few:

While I was on Intel based MacBook Pro I was using Emacs Builds but after switch to new Apple M2 processor I had to move to Emacs Plus since former one had only versions for Intel.

Emacs Plus allows installing older, as well as new, yet unreleased, versions (at the moment of writing this next version that will be released is 29) but sometimes it may be a bit behind Emacs development version.

What is common to all these packages is that they give me a feeling that I don’t have complete control what is going on behind the scene and that I’m not in the complete control over the build process. That’s why I created simple script that can be used to build any Emacs version.

# Be sure to install autoconf and texinfo manually with
# brew install autoconf texinfo
# prior starting this script.
declare -a libraries=("gcc" "jansson" "libxml2" "gnutls" "librsvg" "p11-kit" "libgccjit" "sqlite3" "tree-sitter")

for lib in "${libraries[@]}"
    brew install $lib

# On Intel based processors Homebrew is installed in /usr/local!

for lib in "${libraries[@]}"
    PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"`brew --prefix $lib`/lib/pkgconfig"


./configure --with-native-compilation --with-xwidgets --with-tree-sitter --with-json --with-modules
make install

Usage is very simple. Save above script anywhere on disk as, for example, After cloning Emacs project with

git clone git://

checkout desired version/branch/tag and execute

sh <>

When script finishes, new version will be in <path_to_emacs_folder>/nextstep/

Script is very short and pretty much self explanatory but here are few remarks.

It is important to manually install autoconf and texinfo as is stated in the comment. In the libraries variable script keeps all dependencies required by features given in the ./configure line. Script first installs dependencies with Homebrew, configures build with required features and finally builds Emacs and Mac OS package.

Feel free to use it anyway it suits you and if you have some remarks or improvement suggestions you can send them on any social network given in the side bar.