Skip to content

Instantly share code, notes, and snippets.

@pedz
Created February 14, 2024 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedz/13a56eabd63cb38334a20da4e8129c46 to your computer and use it in GitHub Desktop.
Save pedz/13a56eabd63cb38334a20da4e8129c46 to your computer and use it in GitHub Desktop.
My script to build emacs on macOS. I just used it to build emacs-29.2 on macOS 14.3.1
#!/usr/bin/env zsh -x
# How to verify the signature
# gpg --verify emacs-29.2.tar.xz.sig emacs-29.2.tar.xz
# My build script. I delete the cached eln files to make the test run
# more consistent. If a previous test run successfully compiles a
# file, then a subsequent test run doesn't try when it actually might
# not be able to.
function configure
{
# `brew install emacs-plus@29 --with-native-comp` does this: (from Homebrew's log files)
# ./configure
# --disable-dependency-tracking
# --disable-silent-rules
# --enable-locallisppath=/opt/homebrew/share/emacs/site-lisp
# --infodir=/opt/homebrew/Cellar/emacs-plus@29/29.0.50/share/info/emacs
# --prefix=/opt/homebrew/Cellar/emacs-plus@29/29.0.50
# --with-xml2
# --with-gnutls
# --with-native-compilation
# --without-compress-install
# --without-dbus
# --without-imagemagick
# --with-modules
# --with-rsvg
# --with-ns
# --disable-ns-self-contained
#
# I've added and deleted these options and had various
# combinations "work" and not "work" where "work" is to not spew
# out errors at any point that -lemutls_w can not be found. I've
# had the following not "work" at various times but it is working
# now.
# Stolen from Homebrew's recipe:
# https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/e/emacs.rb
#
# args = %W[
# --disable-silent-rules
# --enable-locallisppath=#{HOMEBREW_PREFIX}/share/emacs/site-lisp
# --infodir=#{info}/emacs
# --prefix=#{prefix}
# --with-gnutls
# --without-x
# --with-xml2
# --without-dbus
# --with-modules
# --without-ns
# --without-imagemagick
# --without-selinux
# --with-tree-sitter
# ]
./configure \
--with-native-compilation \
--with-tree-sitter
}
rm -rf /Applications/Emacs.app &&
rm -rf ~/.config/emacs/eln-cache &&
gmake distclean &&
./autogen.sh &&
configure &&
gmake &&
gmake install &&
echo 'Need password to remove quarantine' &&
sudo xattr -rds com.apple.quarantine nextstep/Emacs.app &&
mv nextstep/Emacs.app /Applications &&
open /Applications/Emacs.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment