I am trying to set up emacs to run as a server to avoid the time required to open individual sessions for each file. This is on OS X El Capitan. Using the instructions provided here, I have the first item described, the emacs executable I presume, at the indicated location on my system:

/Applications/Emacs.app/Contents/MacOS/Emacs --daemon

However the second item described, the emacsclient, is not present (or visible) at the indicated location:

/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient -c $argv

Will I need to install emacsclient separately? I used homebrew to set up emacs originally on this system. Does this method not install emacsclient by default?

  • That command line for emacsclient looks like it's for the emacsformacosx.com builds. I think (although I'm not sure and am not at my Mac just now) that emacsclient should just be under bin, not bin-x86-blahblahblah, assuming your homebrew install built it from scratch. You can use cd and ls to look at what's inside Emacs.app like it's just a normal directory structure. – Alan Third Aug 17 '17 at 8:30

If you used Homebrew to set up Emacs, then you should have emacsclient symlinked under /usr/local/bin/emacsclient.

Simply add (server-start) to your init file, and then emacsclient $FILE should open $FILE on your existing session.

I recommend installing Emacs using the following command:

brew install emacs --with-cocoa --with-ctags --with-gnutls --with-librsvg --with-mailutils --with-imagemagick@6 --with-modules

Don't forget the with-imagemagick@6, since that is fundamental for proper handling of images, should you ever need it. I don't think the brew cask installation ships with emacsclient. If that is what you did, try reinstalling it with the command above.

  • The above suggestion works. There is a symlink to emacsclient at the indicated location. Is there a difference between starting the server using the server-start and the -daemon mode? It seems the former exits the server when the frame exits but the latter keeps the service running in the background until M-x kill-emacs is invoked (see here). I prefer the latter. How do I invoke the daemon using the version installed by homebrew? – Snelephant Aug 19 '17 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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