EN|JA
A build script to make a dmg package of Gnu Emacs for macOS. It will generate the universal binaries with Apple Silicon running macOS26 Tahoe or prior.
It works without any dependefncies on external libraries; supporting treesit available since Emacs29 with several language grammar rules, having GnuTLS runtimes for SSL/TLS connections, and handling images by standard ns GUI functions.
Applies some patches from Emacs Plus. Also, inline patch would be available useful for CJK environment.
And more, modern high resolution icons set delivered from Emacs MacPort is available.
Fetch below and store under sources.
It will recognize both .tar.gz and .tar.xz formats automatically.
Available on Gnu mirror (https://ftpmirror.gnu.org/emacs/).
Implementation of cryptographic algorithm, required for GnuTLS.
Available on Gnu mirror (https://ftpmirror.gnu.org/nettle/).
Implementation of SSL/TLS. Emacs requires GnuTLS, not OpenSSL coming with macOS.
Available on official site (https://www.gnutls.org/download.html).
Note
We checked the versions specified in the build script, but newer ones should work, especially for required libraries. In that case, set versions in the script to match retrieved ones.
Implementation of parsing algorithm used by treesit.
Available on releases page (https://github.com/tree-sitter/tree-sitter/releases) under GitHub project site.
Note
We get sources of required grammar rules automatically with git.
Edit the build script (emacs-dmg-build.sh) to modify the following variables near the top.
Set EMACSVER, NETTLEVER, GNUTLSVER and TREESITVER values to match those of retrieved ones.
Set SITELISP value to site-lisp path, where the lisps available system-wide will be stored.
The default value is /Library/Application Support/Emacs/site-lisp, and recommended such path outside the package.
To apply inline patch which Ishikawa Takaaki coordinates at https://github.com/takaxp/ns-inline-patch , set USEINLINE to yes.
Although, in recent versions of Emacsen, the inline (on the spot) input via OS-native input method is available, activate it if necessary because of some useful extentions, such as changing input modes with toggle-input-method, or hooks when changing input modes.
To use high resolution icons by Emacs MacPort, set USEHRICON to yes.
If enabled, the images from those icons will be used for application icons and toolbar.
To customize application icons as you like, set USEAPPICON to yes.
It would be useful when using icons which the EmacsPlus project coordinates to be available in their build options.
If enabled, Emacs.icns and document.icns are preferred to those of Emacs MacPort.
To customize splash images as you like, set USESPLASH to yes.
If enabled, splash.png, splash.xpm and splash.pbm are overridden, and the default SVG splash image is disabled.
It seems that only PNG images are actually used in the macOS environment, but XPM or PBM images might be used in the environment with low color depth.
Set TSGRAMMARS to language and source information to be included.
By default, we specify those that has been confirmed to work with Emacs30, so select them as appropriate.
The format of each line is like below; to build at the subdirectory, specify the third element.
'language;url-of-git-repository-to-get-source[;subdirectory]'Set ARCHES as an array of target architectures names.
Defined ARCHES=(arm64) by default, to build the uni-arch binaries for Apple Silicon.
Set ARCHES=(x86_64) in Intel environments.
On Apple Silicon running macOS26 Tahoe or prior, set ARCHES=(arm64 x86_64) to build the universal binaries.
Or ARCHES=(x86_64) to cross-build the Intel binaries.
Set CORES to the number of parallel processes on build.
It will be an argument of -j option for make.
The default value is 4, and it works fine in the recent mac environments.
Note
In the environment with more than 4 performance cores, it will reduce a little on build time to set it to the number of those cores. However, since over half of build time is spent in executing configure, it seems to be within the variability.
When setting USEAPPICON or USESPLASH to yes, store corresponding images under custom-images.
It is not necessary to store all of image files since only the found files would be replaced.
- In the case of
USEAPPICON=yes-Emacs.icnsanddocument.icns - In the case of
USESPLASH=yes-splash.png,splash.xpmandsplash.pbm
Install the tools required to build if not installed yet. These would be used only when building and have no dependencies from the dmg package contents to be built.
Install the Xcode command line tools.
$ xcode-select --installInstall it via homebrew and so on.
$ brew install texinfoRequires only if set USEINLINE=yes.
Install it via homebrew and so on.
$ brew install automakeRequires for GnuTLS 3.8.9 or later. Install it via homebrew and so on.
$ brew install pkgconfExecute the build script to create the dmg package under build.
First, it gets required sources of grammar rules for treesit.
It tries to update to the current version with "git pull" if already got; -n available to disable updating.
It takes about 3 minutes in the environment of Apple M5, excluding getting or updating of sources of grammar rules. For universal binaries, it takes about 6 minutes.
$ sh emacs-dmg-build.sh [-n]The source packages are expanded under build.
You can delete them if not necessary.
The script and the patches under patches/custom are provided under CC0.
External patches under patches/plus, patches/inline, and icon resources under icons are provided under other licenses: refer to the LICENSE or README files under each directories for detail.
- Emacs Plus - https://github.com/d12frosted/homebrew-emacs-plus
- ns-inline-patch - https://github.com/takaxp/ns-inline-patch
- Emacs MacPort - https://bitbucket.org/mituharu/emacs-mac