Skip to content

Instantly share code, notes, and snippets.

@gonewest818
Last active December 13, 2019 19:29
Show Gist options
  • Save gonewest818/50169a11d5c88b7343f51da8ae69c145 to your computer and use it in GitHub Desktop.
Save gonewest818/50169a11d5c88b7343f51da8ae69c145 to your computer and use it in GitHub Desktop.
MacOS: configure launchd to run `emacs --fg-daemon` at login
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.gnu.emacs-daemon</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/emacs</string>
<string>--fg-daemon</string>
</array>
<key>LSUIElement</key>
<true/>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Gnu Emacs Daemon</string>
<key>StandardErrorPath</key>
<string>{HOME}/Library/logs/emacs-daemon-stderr.log</string>
<key>StandardOutPath</key>
<string>{HOME}/Library/logs/emacs-daemon-stdout.log</string>
</dict>
</plist>
@gonewest818
Copy link
Author

Install:

  • this config assumes the binary is /usr/local/bin/emacs ... change if needed
  • in the plist file, must also replace {HOME} with the full path to your home directory
  • then copy the file to {HOME}/Library/LaunchAgents/org.gnu.emacs-daemon.plist
$ launchctl load {HOME}/Library/LaunchAgents/org.gnu.emacs-daemon.plist
$ launchctl start {HOME}/Library/LaunchAgents/org.gnu.emacs-daemon.plist
$ emacsclient -c -n

@gonewest818
Copy link
Author

Caveats:

  • the LSUIElement boolean seems to toggle off the dock icon until the first time you actually open a frame. After that, you're stuck with a dock icon even once the client frame is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment