Emacs GUI will not open over X forwarding from macOS

Tags mac


Emacs will not open when connected to an OSX/macOS computer with "ssh -X" or "ssh -Y."

The following string of errors may appear:

Jul 19 09:02:44  Emacs[87567] <Error>: Set a breakpoint at CGSLogError to catch errors as they are logged.
Jul 19 09:02:44  Emacs[87567] <Error>: This user is not allowed access to the window system right now.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
Jul 19 09:02:45  Emacs[87567] <Warning>: CGSConnectionByID: 0 is not a valid connection ID.
(error repeated)
2017-07-19 09:02:45.270 Emacs[87567:12773428] CFPasteboardRef CFPasteboardCreate(CFAllocatorRef, CFStringRef) : failed to create global data
(error repeated)


  • macOS
  • Connected to the Mac with ssh -X or ssh -Y


The Emacs.app program is built to use the macOS window system, not X11.


  1. Install emacs with the x11 variant through MacPorts with this command: port install emacs +x11

External Resources

Solution found on Stack Overflow.

For more information on Macports please refer to our public "MacPorts" article.


Print Article


Article ID: 1879
Fri 5/29/20 12:20 PM
Fri 3/8/24 10:23 AM