At work I get a choice of two laptops to use, Windows or Mac. Being a linux guy, I thought the MacBook Pro will be a good fit.
So I bring the MacBook Pro laptop home, and realize it doesn't have a right-ctrl key. And the bottom panel is annoying as hell. So I say, no problem, I'll sort all that out later, for now I'll use it as a server and remotely ssh into it from my crispy Xfce workstation environment. Well...
I've spent about a day trying to figure out:
How to ssh into the mac from my Fedora workstation, run emacs and have it show up (XForwarded) on my linux workstation ? You know like this:
I've installed XQuartz and changed /etc/sshd_config
and /private/etc/sshd_config
with:
X11Forwarding yes
XAuthLocation /opt/X11/bin/xauth
Mind you, xeyes
works, and so does xclock
, yay !!!
Apparently X forwarding is working okay, since other gui apps are showing up remotely. But as for Emacs, foggetaboutit.
The default Emacs from /usr/bin/emacs
just runs it in -nw
mode. Then I've installed the latest Emacs 24.3 (into /Applications/Emacs.app/Contents/MacOS/Emacs
). This time, if I'm physically logged into the laptop (i.e. from the laptop keyboard) running Emacs from ssh shows up on the laptop's screen !!! WTF? If I logout of the laptop, then I get:
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
I'm at my wits ends. Any ideas why other X apps work? Anything special about Emacs?
Emacs Tramp Brings Your Server Into Emacs These tasks can be easily accomplished with a basic terminal emulator and SSH. You can log into your server, run scripts, edit files, and do all the work you need to do.
You can find precompiled versions of emacs and Emacs. app at http://emacsformacosx.com/. Versions of macOS prior to 10.15 Catalina include a copy of GNU Emacs 22 without GUI support compiled in and thus Emacs is automatically available on all but the most recent versions of macOS via the terminal.
The Emacs.app
binary is built to use Mac OS X's window system (we call it "ns" around here), which has nothing to do with X11, so you can't forward it over the network to another host. Instead, you want to install another Emacs on your Mac, which is built to use the X11 window system (so you can use it locally via Xquartz (which lets X11 clients use the native Mac OS X display), or you can use it remotely like any other X11 client).
The easiest way is probably to built it yourself: get the emacs-24.3.tar.gz
source code and compile it with ./configure --with-x; make
.
With Mac Ports x11 or gtk variant has to be selected, like this:
sudo port install emacs +x11
or that:
sudo port install emacs +gtk
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With