I understand that I should be able to use X11 to show graphs from a remote R when I use a local emacs to connect to the remote machine with tramp.
I have tried a few different things but can not get it to work. I know that the server will work with X11 as if I ssh in using a normal terminal it works.
Currently my .emacs
file has:
;; emacs x11 tramp
(add-to-list 'tramp-remote-process-environment
(format "DISPLAY=%s" (getenv "DISPLAY")))
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
'("sshx11"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
("-e" "none") ("-Y") ("%h"))) ; tried -Y and -X :(
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
("-o" "StrictHostKeyChecking=no")
("-o" "ForwardX11=yes")))
(tramp-default-port 22)))
(tramp-set-completion-function "sshx11" tramp-completion-function-alist-ssh))
On my local machine I also have two files, config
and sshd_config
in my .ssh
folder. The latter simply contains X11Forwarding yes
whereas the former has Host my_alias
Hostname myhost
User myusername
ForwardX11 yes
ForwardX11Trusted yes
(with appropriate subs)
I connect to my server with C-x C-f sshx11:user@host:/
I then do M-x shell
and select the "remote shell path" (to bin bash) and the starting directory.
Now when in the shell if I try echo $DISPLAY
I get
/private/tmp/com.apple.launchd.zmPeFoMlxA/org.macosforge.xquartz:0
But if I try to load an xprogram such as xterm
to test I get:
xterm Xt error: Can't open display: /private/tmp/com.apple.launchd.zmPeFoMlxA/org.macosforge.xquartz:0