用户工具

站点工具


build_emacs_on_macos

**这是本文档旧的修订版!**

Build Emacs on macOS

步骤

下载源码

git clone git://git.savannah.gnu.org/emacs.git

# 或者 git clone --depth 1 https://git.savannah.gnu.org/git/emacs.git

cd emacs
git checkout emacs-28 # 以emacs 28为例,你可以切换到其他的branch

下载依赖

# 使用 Homebrew 安装依赖
brew install autoconf automake libtool gnutls texinfo
brew install gcc libgccjit  # 用于原生编译(可选但推荐)

编译


cd workspace_opensource/emacs

# 清理之前的构建
make distclean 2>/dev/null || true

# 生成配置脚本
./autogen.sh

./configure \
  --with-ns \
  --enable-ns-self-contained \
  --without-x \
  --without-dbus \
  --without-gconf \
  --without-gsettings \
  --without-pop \
  --without-mailutils \
  --without-sound \
  --without-rsvg \
  --without-webp \
  --with-native-compilation=aot \
  CFLAGS="-O3 -march=native -mtune=native -flto -pipe" \
  LDFLAGS="-flto"

make -j$(sysctl -n hw.ncpu)
make install  # 现在不会尝试安装到系统目录了

echo "构建完成!Emacs.app 位于 nextstep/Emacs.app"

测试

# 在 Finder 中打开 Emacs,方便拖到 /Applications
open -R nextstep/Emacs.app
mv nextSteps/Emacs.app /Applications

参考链接

build_emacs_on_macos.1767924350.txt.gz · 最后更改: jiaji