I would like to set the shell EDITOR to use the existing running instance of GUI Emacs.

On macOS I can type open -a Emacs file to edit file that way. But how would EDITOR look to work that way?

What does not work: export EDITOR="emacs" # launches new gui emacs export EDITOR="emacsclient" # launches terminal emacs in current shell export EDITOR="open -a Emacs" # quits editing right away

  • You'll probably want to try out running a daemon and then connecting to it. That should make it easy to pop up a window for editing. open is probably spawning a process and exiting, which tricks programs that run an editor that it's done already.
    – user12563
    Dec 11, 2017 at 21:57
  • 1
    "export EDITOR="emacsclient" # launches terminal emacs in current shell" is noteworthy. That would not work at all unless there was an Emacs server already running. How/where/when are you starting that server?
    – phils
    Dec 11, 2017 at 22:48
  • And because this is about OSX: Does M-x emacs-version report the same thing when you run emacs vs when you run emacsclient ?
    – phils
    Dec 11, 2017 at 22:50
  • phils, thanks for the tip. indeed, i had a server running that i was not aware of (installed via homebrew). i have now changed EDITOR to emacsclient and now it behaves as i would like. I guess the GUI also runs the server within it.
    – styts
    Dec 11, 2017 at 23:09

1 Answer 1


Answering my own question; I had a server running that I was not aware of.

brew services list

After stopping it with brew services stop emacs-plus or brew services stop emacs, I was able to configure the EDITOR with

export EDITOR="emacsclient"

to use the Emacs.app GUI as the server from the shell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.