jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
484 stars 50 forks source link

feat(cli): add "emacs" CLI launcher script to Emacs.app/Conents/MacOS/bin #43

Closed jimeh closed 3 years ago

jimeh commented 3 years ago

This makes setting up a emacs terminal command that works with the self-contained Emacs.app bundle much simpler, as you just need to add Emacs.app/Conents/MacOS/bin to your PATH.

For example, if you place Emacs.app in /Applications, add this to your shell setup:

if [ -d "/Applications/Emacs.app/Contents/MacOS/bin" ]; then
  export PATH="/Applications/Emacs.app/Contents/MacOS/bin:$PATH"
  alias emacs="emacs -nw" # Always launch "emacs" in terminal mode.
fi

The launcher script works by figuring out it's own absolute path on disk, even if you are using a symlink to the script, it will resolve to correct real path. This allows it to execute the main Emacs.app/Contents/MacOS/Emacs executable via the correct path, so it can correctly pick up its dependencies from within the Emacs.app bundle.

Fixes #41