At this point I believe I am using the emacs version on my Mac that is built by Homebrew and the "stock" emacs on Ubuntu 18.04.

I set up emacs server on the Ubuntu host as it is described in Starting Emacs Daemon with systemd and connect to it using emacsclient as described. This all works fine.

I also use emacs on my Mac with tramp to access the file systems on the Ubuntu host. And this works fine too. Even magit works which is rather spectacular.

The main reason for the emacs in daemon mode on the Ubuntu host is to replace tmux so if the connection drops, the shell process continues and I can later view the *shell* buffer.

Is there a way for me to view and interact with the *shell* buffer from the emacs on my Mac?

The ultimate goal here is to have just one emacs on my Mac and the ability to start and run commands on the remote Ubuntu system in such a way that if the connection drops, the remote commands continue to run and I can later connect and view the output like tmux, screen, or emacs in daemon mode can do.

  • So you're not trying to run emacsclient on the OSX machine and connect it to the server on the remote host; but rather you're trying to have a separate instance of Emacs interacting with a remote emacs server (but also doing its own things locally on OSX), correct? To my knowledge you can't do that (other than by using a term buffer to run emacsclient on the remote host via ssh, which would be a bit awkward).
    – phils
    Jul 6, 2019 at 5:46
  • @phils I believe you have the question properly interpreted. But, you gave me an idea that I will toy with... Perhaps having a local emacsclient connected to the Ubuntu emacs-server may be at least slightly better than running the emacsclient on the Ubuntu machine.
    – pedz
    Jul 6, 2019 at 17:24
  • I hope you get that to work. emacsclient over tcp between macOS and Ubuntu is not something I've managed to get working
    – rpluim
    Jul 7, 2019 at 10:02
  • FYI: The closest I've come is ssh $1 "emacsclient -n -c -e nil -u" < /dev/null > /dev/null 2>&1 where $1 is the host. When the remote host is rebooted, I ssh to the remote host and start emacs via emacs --daemon. This isn't / wasn't my initial goal but it isn't too bad.
    – pedz
    Aug 23, 2022 at 14:58


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.