Skip to content

Instantly share code, notes, and snippets.

@btskinner
Created May 22, 2023 17:36
Show Gist options
  • Save btskinner/ca007e4d3a6e56afaac0765281afb669 to your computer and use it in GitHub Desktop.
Save btskinner/ca007e4d3a6e56afaac0765281afb669 to your computer and use it in GitHub Desktop.
Script to make and move Emacs.app from homebrew emacs-mac to /Applications so that Spotlight can find it
#!/usr/bin/env bash
# Script to create Emacs.app that will be placed in Applications folder.
# This is cobbled together from two sources. All credit to them, unless it
# doesn't work, in which case, errors are my fault:
#
# (1) https://github.com/railwaycat/homebrew-emacsmacport/blob/master/docs/emacs-start-helpers.md
# (2) https://mathiasbynens.be/notes/shell-script-mac-apps
# You may need to make the script executable on your machine. In terminal
# directory of this script:
# $ chmod +x make_emacs_app.sh
# (1) create an application that Spotlight will recogize from emacs-mac
osacompile -o Emacs.app \
-e "tell application \"Finder\" to open POSIX file \"$(brew --prefix)/opt/emacs-mac/Emacs.app\""
# (2) move to /Applications
mv Emacs.app /Applications
# NB: To add icons
#
# 1. Copy Emacs.icns file images from /usr/local/opt/Emacs.app/Contents/Resources
# 2. Right-click the Emacs.app file and select “Get Info”
# 3. Select the app icon in the top left corner by clicking it once and paste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment