Building emacs from source on macOS

brandelune profile image Jean-Christophe Helary ・1 min read

Caveat: I am on the latest Mojave version with Xcode and the command line utilities installed and the following instructions work for me :)

If you don't have Xcode and the command line utilities, install them first.

1) install the headers so that the build process can access them:

see: https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave/

command: cp /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg ~/Desktop

and then double-click on the package to install them in /usr/include

2) get emacs from its git repository

see: https://savannah.gnu.org/projects/emacs/

command: git clone -b master git://git.sv.gnu.org/emacs.git

3) enter the emacs directory and run "make install"

Emacs.app will be found in the nextstep/ directory

You can call it with Spotlight, and you can modify your path or create aliases so as to access the corresponding "emacs" command from the command line.

Once you have that done, just do a "git pull" regularly to get what's new and rebuild when you want to use the new code.

Posted on by:

brandelune profile

Jean-Christophe Helary


In Japan since '97. Translating and localizing on Mac since 2000. FOSS advocate and user. Super proud that I have some code that's been accepted in Emacs :^)


Editor guide

I recently wanted to build a patched version of the Emacs installed by brew/cask on macos. Notes are here (in the emacs bug reporting system), FYI:

-- Thanks!