0
  • OS X 10.11
  • Emacs 24.5: /Applications/Emacs.app
  • emacsclient: /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient
  • (server-start) in my .emacs file
  • % emacsclient some-file

Result is:

/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient: can't find socket; have you started the server? To start the server in Emacs, type "M-x server-start".

/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient: No socket or alternate editor. Please use:

--socket-name --server-file (or environment variable EMACS_SERVER_FILE) --alternate-editor (or environment variable ALTERNATE_EDITOR)

I have also tried this running Emacs and emacsclient as installed with MacPorts with the same result.

This is been happening for many years. I can't even remember the last time I was able to use emacsclient. I have searched extensively for information about this, but all I can find is information I already know as a sophisticated Emacs user of many decades.

I am not looking to run Emacs as a daemon.

Suggestions?

  • 1
    You want an emacs server to run, but not as a daemon? Isn't this the whole point of an emacs server? – Kaligule Aug 30 '16 at 20:33
  • Not at all. All documentation says you can run it either way and which way you do it is a matter of preference. As an experiment I guess I should try it as a daemon, but it shouldn't be necessary. – Mitchell Model Sep 1 '16 at 16:03
  • Try running M-x server-force-delete. If the server is really running, you should see a message like Connection file "/tmp/emacs101/server" deleted". If you don't see a message like that, you may not have a running server after all. – nispio Sep 28 '16 at 3:25
1

emacsclient with no option contacts a running Emacs. You need to either start Emacs with your session (presumably as a daemon) or instruct emacsclient to start Emacs if there isn't one already.

To instruct emacsclient to start Emacs if it isn't already running, run either

emacsclient --alternate-editor=''

or

emacsclient -a ''

(You can put this in a shell alias or in a wrapper script.)

  • I neglected to say in my OP that Emacs.app is running, but I did say that (server-start) is in my .emacs` file. So indeed, I want emacsclient to contacts my running Emacs.app. – Mitchell Model Sep 1 '16 at 16:05
0

I had the same issue because I was running emacsclient from /usr/bin/emacsclient, now I use this:

export EDITOR='/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait --alternate-editor=/Applications/Emacs.app/Contents/MacOS/Emacs'
alias e=$EDITOR

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.