Using Automator to create an Emacs.app for running Emacs Client & Server

Or: Back To The Mac 1

After using only Linux machines for work for the past 5 years, my next machine will be a MacBook. That's why I'm working on improving my development environment on macOS as best as I can now, something that's not really been necessary when using my personal Mac.

First order of business: how do I start the Emacs server and connect to it with the emacsclient?

I'm using Emacs+ from homebrew:

brew install emacs-plus@29

Once installed, it works fine, but neither do Spotlight - or Alfred - see any Emacs.app, nor do I know how to start the server or start multiple clients that connect to it.

I found the solution on the blog of one Alex Balgavy: Setting up Emacs as a daemon on macOS. Then I simplified it for my purposes.

All I needed to do is create a new Automator document of type Application that runs this shell script:

export PATH=/opt/homebrew/bin:$PATH
emacsclient -c -a '' >/dev/null 2>&1 &

-c creates a GUI frame, and -a '' connects to the server named '' - or starts it if it's not already running.

Every time I call Emacs.app, I get a new fresh Emacs window, just like I'm used to on my Linux machine that runs the Emacs server from systemd.

Categories: #tech Tags: #emacs #macos