I have a linux machine which I am accessing via ssh with a MacBook. I wish to be able to view some .png files. I have run ssh with the -X option, edited ssh_config with these lines:

ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes

When I try running $display fileName.png I get the error

display: unable to open X server ' @ error/display.c/DisplayImageCommand/426.

and if i run

$ DISPLAY=:0 display fileName.png

then it acts as if something is running in the terminal but I can't view the image.

I've also tried opening it with eog fileName.png and get the error

Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused
  • 1
    It is unclear from the question as written, but you did edit ssh_config on the machine you want to connect to, and use ssh -X on the machine you want to connect from, right? And you restarted sshd after making the configuration changes? And you have X11 installed and open on the MacBook?
    – Fox
    Nov 1, 2017 at 13:09
  • It's important to remember that the X11 forwarding is connecting the display only. The programs being run need to be installed on the remote machine. So, it's rather unlikely that eog fileName.png is going to work if you are ssh-ed into a Mac. Nov 1, 2017 at 13:33
  • The linux is the remote machine and I am ssh-ing with my mac. Installed X11 and seems to be working now. Thanks! :) Nov 1, 2017 at 13:34
  • Note: Moreover, the $DISPLAY you obtain using ssh -X is usually not :0 but a value incremented for each ssh -X connection, and starting with X11DisplayOffset (sshd_config, usually #X11DisplayOffset 10 ) Check it: echo $DISPLAY
    – tonioc
    Nov 1, 2017 at 18:06

2 Answers 2


You don't have xserver default installed on your OSX, so xclient has nothing to connect with.

"X11 is no longer included with Mac, but X11 server and client libraries are available from the XQuartz project." - https://support.apple.com/en-us/HT201341


The best way to view images in your terminal on a Mac is with iTerm + imgcat (part of it's shell utilities). You can actually install imgcat on the linux machine and then connect to it with ssh in an iTerm instance and it will display images just fine.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .