I used to have Emacs 25.xx on my windows pc and was very happy with the daemon/server mode of emacs. Emacs started via batch-script on startup and everything worked fine -- on every subsequent call Emacs just started instantly. Just as it should. :-)

However, due to scrolling problems in AucTeX I went back to 24.5.1. Now Emacs doesn't start in server mode.

I found http://wikemacs.org/wiki/Emacs_server and it says at the bottom that on Microsoft Windows you need to have at least Emacs version 25 to use the server mode.

Is this just outdated information? Is there really no way to run Emacs 24 in server mode on Windows? Has anyone of you experience with running Emacs in server mode on Windows?

If that's important: I use Windows 10. Thanks in advance for any input on that topic.

  • 1
    I never had much luck with --daemon on WIndows, but have used (server-start) in my init file and emacsclient for years with various versions. Perhaps you could just have Emacs run minimized at startup and achieve the same result?
    – glucas
    Aug 3, 2016 at 16:30
  • Are your problems with scrolling related to (display-graphic-p)? When you start up Emacs as a server it might have that function return nil, so you might have problems with any extension that has some features that require a graphic display to work. I had to do this to get web-mode to work properly when I use Emacs as a server.
    – user12563
    Sep 3, 2016 at 15:22
  • gnuclient is another alternative, comes from xemacs but perhaps more compatible with windows.
    – Name
    Jan 1, 2017 at 16:08

3 Answers 3


Add the following code to your init.el.

(require 'server)
(unless (server-running-p)
   ((eq system-type 'windows-nt)
    (setq server-auth-dir "~\\.emacs.d\\server\\"))
   ((eq system-type 'gnu/linux)
    (setq server-auth-dir "~/.emacs.d/server/")))
  (setq server-name "emacs-server-file")

Then you can get access to server with emacsclientw.exe in the bin/ directory under your emacs installation path.

  • Okay, I start emacs with: "...\emacs\bin\emacsclientw.exe" --alternate-editor="...\emacs\bin\runemacs.exe" -c. But now I get an error message saying: "...\bin\emacsclientw.exe: connect: A connection could not be established, because the target computer refused the connection." (I have a german error message, this is just a translation)
    – itmuckel
    Aug 7, 2016 at 10:10
  • Okay, the error message is really clear. I just checked if my startup scripts (they just start emacs with --daemon argument) have an effect. They don't. Emacs 24 doesn't create a background process anymore, I can see it in the task-manager. So of course emacsclientw.exe cannot connect to a server. But even if I manually start a server with M-x + "start-server" nothing happens. Am I missing something? :-(
    – itmuckel
    Aug 7, 2016 at 10:17
  • 1
    @Micha90 When you call server-start there is no added background process; emacsclient connects to the foreground one. However if you set server-name to a non-default value as suggested in this answer, you have to tell emacsclient about it as well.
    – npostavs
    Sep 3, 2016 at 16:22
  • I've used (server-start) on Windows without having to set the auth dir or name -- things should work fine with the defaults. As noted already the --daemon option is not supported prior to Emacs 25 and there is no background process, but you can launch Emacs, call server-start, and connect using emacsclientw. You can set the ALTERNATE_EDITOR environment variable or have a startup task launch Emacs, depending on whether you want it always running or launched on first invocation.
    – glucas
    Dec 2, 2016 at 16:04
  • 1
    I had the same socket problem after using server-start, and when I checked the server-name variable it seems emacs(?) had auto-populated it with something. Mine was server4488. After adding that to my command line, clientw could connect.
    – tenpn
    Nov 24, 2017 at 21:51

I can verify that it is possible to run Emacs 24 as a daemon on Windows 10, if you use Cygwin. If you're using the Windows-native Cygwin version (Cygwin package emacs-w32), then I think you'll need to start the daemon through bash, but you can call emacsclient directly from Windows, and the resulting instances will connect to the daemon just fine.


I had problem using emacsclient to open a file. The reason ended up being Windows firewall blocking the connection to server since my account is admin.

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.