This is an experimental build of the emacs-mac (aka Carbon1 Emacs) port of emacs, updated for Emacs v30.1.
Warning
This is an experimental build of emacs-mac
; there will certainly be bugs. We are looking for feedback and testing from experienced users. If you are familiar with or willing to learn about running new builds of Emacs under a debugger, perfect. If you are a Mac developer familiar with ObjC or Mac Window frameworks, even better! Other users should stick to the official NS build or recent v29.4 emacs-mac release for now.
Known working systems:
- MacOS 15 (Sequoia) on ARM64 (M1, M2, M3, M4), X86_64 (Intel)
- MacOS 14 (Sonoma) on ARM64 (M1, M3)
- MacOS 12 (Monterey) on X86_64 (Intel)
Please see the issues for advice on build configurations for your system.
Important
Please open an issue to report your experiences, even if you encounter no problems. Mention your OS version, CPU, and any other relevant details, including the build/configure flags you used.
This build is kept current with the emacs-30
release branch.
See the emacs-mac-30_1_exp
branch and the file README-mac
for additional compile instructions. Briefly:
Note
On MacOS, gcc
is actually aliased to the clang
compiler, which is required to build emacs-mac
. Recent gcc
versions either cannot build for the architecture (e.g. Apple Silicon) and/or do not support blocks, which this build uses heavily.
If you'd like to build with tree-sitter support, native-compilation, and RSVG (all recommended), first install the necessary libraries:
brew install tree-sitter libgccjit librsvg
You can configure the app either as self-contained (all resources live within the app), or non-self-contained (the default). A self-contained app is recommended. The recommended configuration options are given below; see the file README-mac
for others.
A self-contained app by default will go into /Applications/Emacs.app
.
./autogen.sh
CFLAGS="-O3 -mcpu=native" ./configure --with-native-compilation --with-tree-sitter --enable-mac-app=yes --enable-mac-self-contained
You can specify another build directory for the self-contained app using --enable-mac-app=/path/to/dir
.
Note
Note the yes
argument to --enable-mac-app=yes
, which is required to build a self-contained app under /Applications
.
./autogen.sh
CFLAGS="-O3 -mcpu=native" ./configure --with-native-compilation --with-tree-sitter
make -j6 # or however many CPUs you want to use
You'll find the staging build of the app under mac/
.
This step compresses EL files and fully populates the app.
make install # Installs all resources under /Applications/Emacs.app (or wherever your self-contained build is going)
sudo make install # installs resources in, e.g., /usr/local/share/emacs/30.1.50
If you choose not to make install
, but instead want to run the application directly from the mac/
sub-directory, you may need to:
% cd mac/
% ln -s ../native-lisp Emacs.app/Contents/
to associate the native lisp files. This is useful for debugging, to quickly rebuild and test, for example (saving the install step). But a self-contained app build is easier.
Several additional features and fixes have been added on top of emacs-mac
and Emacs proper.
- A
New Frame
Dock Menu Item - New variable
mac-underwave-thickness
to customize the thickness of squiggly underlines (e.g. with linters or spell-checkers)
- Take care to avoid crashes when selecting certain fonts from the system font panel.
- Prevent zombie "Emacs Web Content" processes on SVG load,
restoring normal WebView SVG rendering for MacOS v14+. Update:WebView
is deprecated, so this has been reverted and another workaround installed. It's recommended to build with RSVG (it is enabled by default if thelibrsvg2
library is found during build).
If you get crashes or just want to help with debugging, it would be very useful to run emacs-mac under lldb
, the clang debugger. Here's how:
- Build emacs-mac with debug flags:
CFLAGS="-O0 -g3" ./configure --with-native-compilation --with-tree-sitter --enable-mac-app=yes
- Link in the native-lisp directory.
- In an
~/.lldbinit
file, addsettings set target.load-cwd-lldbinit true
, so Emacs can read the custom lldb commands it has defined. - Start the emacs binary from the
src/
directory, like:Then%lldb ../mac/Emacs.app
run
(or better,run -Q
). - Now cause your crash to occur, go
up
to the frame of interest, and usexprint
,p
, etc. on the potentially problematic variables. - You can also try
gui
which is a little curses-based terminal GUI inside lldb (slow for me though), orrealgud-lldb
which isn't very complete but can do some things.
You can read about the issues encountered during the merge of Emacs v30 in the debugging notes.
Footnotes
-
Calling this the "Carbon" port is a vestigial nod to its origins back in the pre-OSX days. It is also what
M-x emacs-version
says. But Carbon is a misnomer now. The ancient Carbon API never supported 64bit applications, and was deprecated and removed by Apple in 2019. A few convenience functions do remain (e.g.Carbon.h
), and these are used by the NS build as well. Both NS and emacs-mac are Cocoa applications. ↩