I am running into problems creating and connecting to an Emacs daemon on RHEL 6. I am using Emacs 23.1.1.

The daemon starts correctly:

emacs --daemon=foo
Starting Emacs daemon.

… but when I try to launch a client against it I get:

$ emacsclient -f foo -t
emacsclient: connected to remote socket at
emacsclient: connect: Network is unreachable
Starting Emacs daemon.
Unable to start the daemon.
Another instance of Emacs is running the server, either as daemon or interactively.
You can use emacsclient to connect to that Emacs process.
Error: server did not start correctly

Error: Could not start the Emacs daemon

I tried to find the port Emacs listens to by way of lsof:

$ ps aux | grep -i emacs | grep -v grep
mperdike 19396  0.3  0.4 259832 17596 ?        Ss   18:21   0:00 emacs -nw --daemon=foo
$ lsof -Pan -p 19396 -i

… but as can be seen in the screen above lsof didn't produce any output (maybe that's because I am not a sudoer).

1 Answer 1


Use this command to invoke the client:

emacsclient -s foo -t

-s is for giving a server name in contrast to -f that specifies the server file and that's a socket with full path.

Emacs starts the server on a local socket (represented by a file) if available -- and with linux it is. So, no TCP socket is opened.

  • I have a custom emacsclient bash script that looks under ~/.emacs.d/server and asks me which emacs server I wish to connect to. With the local (UNIX domain) sockets I get no files under ~/.emacs.d/server. Is there a way to discover which servers are running on local (UNIX domain) sockets from bash ? Oct 24, 2016 at 17:49
  • 1
    Looks like you are using server-use-tcp. If not the socket is found in the directory given by server-socket-dir. To list open unix sockets you can use ss -lp | grep emacs. Oct 25, 2016 at 12:18

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.