mikevdh
Posts: 15
Joined: Tue Jan 21, 2014 9:56 pm

error cant open display

Mon Jan 27, 2014 8:21 pm

Hi All!!

I have my raspberry running and use ssh on my mac to control the raspberry. But i have the following problem. I want to use my mac to display images over ssh. But what ever i try i keep getting the same error " Error: Can't open display" . I checked the ssh config file for X11 forwarding and i have the latest XQuartz running on my mac. Any idea how to solve this?

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: error cant open display

Mon Jan 27, 2014 9:08 pm

Are you using ssh -X ... when you log into the Raspberry Pi? If so when you log in what output do you get from:-

Code: Select all

echo $DISPLAY

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: error cant open display

Mon Jan 27, 2014 9:11 pm

If your network IP address for your Mac is say 192.168.1.100 then enter the following command (and change IP accordingly):
export DISPLAY=192.168.1.100:0.0

Richard S,

mikevdh
Posts: 15
Joined: Tue Jan 21, 2014 9:56 pm

Re: error cant open display

Tue Jan 28, 2014 7:31 pm

I keep getting the same error. I changed the DISPLAY to the ip of my mac but then i get the error Error: Can't open display: 192.168.2.1:0.0

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: error cant open display

Tue Jan 28, 2014 7:34 pm

If that's the case then the Mac is probably refusing remote connections.
I'm not familiar with Mac software but there maybe some kind of xhosts file you need to edit first to enable Pi remote access.

Richard S.

mikevdh
Posts: 15
Joined: Tue Jan 21, 2014 9:56 pm

Re: error cant open display

Tue Jan 28, 2014 8:25 pm

I finally have it working. I found this link that helped me out.

http://javalinpilipinas.blogspot.nl/201 ... h-ssh.html

User avatar
AndyD
Posts: 2334
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: error cant open display

Tue Jan 28, 2014 8:28 pm

If you are using X11 forwarding over SSH your DISPLAY variable should be set automatically. You should get something like:-

Code: Select all

localhost:10.0
not

Code: Select all

192.168.2.1:0.0

mikevdh
Posts: 15
Joined: Tue Jan 21, 2014 9:56 pm

Re: error cant open display

Wed Jan 29, 2014 7:30 pm

i needed to change the x11 forwarding on my mac. Thats was the problem. Now i get the local:10.0 and it works.

TNX all!

Return to “Troubleshooting”