Flaky Goodness

Upgrading to Emacs 29.4 on Apple Silicon Macs

August 17, 2024

This is an update to my post about compiling Emacs 29.1 from source. Probably due to shifting dependencies that procedure no longer seems to work for me in Sonoma 14.6.1, and there have also been some important security fixes to Emacs and Org Mode that make it advantageous to update as soon as possible.

Unfortunately the Mitsuharu Emacs Mac Port has not yet been tagged and released for any version past 29.1. Happily, the work branch has been updated to 29.4 and this is what I’m using to write this post. Because this isn’t an officially tagged release, I am expecting that there might be issues down the road but it seems to be working well so far.

Remove existing Emacs

Backup and delete /Applications/Emacs.app if you have one. I highly encourage you to keep a backup of your old Emacs around for a while in case you hit any snags building the new one.

Update Xcode command-line tools

Don’t skip this step of reinstalling the latest version of the tools. I suspect you’ll need to install Xcode first if you don’t already have it. I am currently using Xcode 15.4.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

Install/re-install dependencies

brew update
brew reinstall gcc
brew install libgccjit texinfo tree-sitter jansson

Get a fresh clone of Emacs

Currently the work branch is the one with Emacs 29.4. Hopefully there will be a tagged release soon.

git clone https://bitbucket.org/mituharu/emacs-mac
cd emacs-mac
git checkout work

Configure and make

autoreconf -i

./configure \ 
  --with-native-compilation \ 
  --with-modules \ 
  --enable-mac-app \ 
  --with-xwidgets \ 
  --with-tree-sitter \ 
  --prefix=/Applications/Emacs.app/Contents/Resources
    
make

Add additional required resources

The build process leaves out some required lisp resources, which you will discover if you try to launch the Emacs.app bundle from Finder or from console by typing:

mac/Emacs.app/Contents/MacOS/Emacs

You can manually move these required files into the bundle with:

mkdir -p mac/Emacs.app/Contents/Resources/share/emacs/29.4
mv lisp mac/Emacs.app/Contents/Resources/share/emacs/29.4
mv etc mac/Emacs.app/Contents/Resources/share/emacs/29.4
mv native-lisp mac/Emacs.app/Contents

Move the built Emacs.app into /Applications

Drag Emacs.app into your Applications folder and you should be ready to go. Remember that Emacs will be slow for a while after first launch as native compilation makes its way through all the Emacs Lisp sources packaged with Emacs.

UPDATE 2024-08-18 to move the etc folder (with documentation) into the app bundle