[OS X Emacs] Aquamacs(mac) + remote emacsclient(linux)?

David Reitter david.reitter at gmail.com
Tue Sep 13 14:33:29 EDT 2011

On Sep 12, 2011, at 3:38 PM, Jack Repenning wrote:

> Sorry, I've found plenty of partial answers in the dox and on the web, but I can't quite thread them all together. Is there a way?
> I want to 
> - run Aquamacs on my "local" computer, the one with the keyboard and display
> - and run emacs-server there inside
> - open a local Terminal window
> - ssh to the "remote" computer, and run something-like-emacsclient with no doubt some command args voodoo
> - which connects back from the "remote" computer to my emacs-server
> - causing it to use a Tramp URL to access the actual file
> I've figured out how to drive Tramp appropriately, that part's working. But the emacsclient (--version 21.4) on the "remote" system, where the files are but no display, doesn't seem to speak network-ese:

So, basically, you want to work on some remote machine via SSH, but be able to edit files there using your local Aquamacs installation.  So far, so good.

Yes, in a pure-unix world, you'd use X, but that wouldn't give you Aquamacs.

For what you need to do, you need to have your local machine visible and accessible for the remote.  That is, the IP must be public and the port open.  The best way would probably be to instruct SSH to tunnel the connection (with this port) along with your regular terminal connection.

The emacs server must be told to use TCP rather than a local socket (set `server-use-tcp' variable according to emacsclient manual.  Set `server-host' to the right name or IP (of the server), and give emacsclient the --server-file option (or specify EMACS_SERVER_FILE).  For this, the remote must have access to this file (created by the server), and this is where things get complicated.

The server file, on Aquamacs, is "/Users/dr/Library/Application Support/Aquamacs Emacs/server/server".  If you inspect it, you'll see some ports, so I would simply try leaving it in place, but tunneling the local port to the remote, and creating a "fake" server file (try ~/.emacs.d/server/server on a standard unix machine) with the port numbers you choose to use on the remote end.  Maybe emacsclient will work that way.

Finally, make sure you use compatible emacsclient versions.  Aquamacs 2.x is based on Emacs 23, and as such, the emacsclient must be of version 23.x.  I'm not sure if 24.x is compatible.  Emacsclient 22 and older are not compatible.

And, finally, finally, I don't know if tramp works, but this blog post gives you the scripts that do, I think, essentially what I outline above, and it does use tramp:

I see no reason why this shouldn't work with Aquamacs as long as you use a compatible emacsclient version on the remote.

Hope that helps.

http://aquamacs.org -- Aquamacs: Emacs on Mac OS X
http://aquamacs.org/donate -- Could we help you? Return the favor and support the Aquamacs Project!

More information about the MacOSX-Emacs mailing list