You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Problems with X11 - Can't open display

Hi -

I am trying to use X11 from a Mac running 10.5.7 to remotely access programs on a Linux machine but keep getting the following error when I attempt to launch a new xterm.

[mac]$ echo $DISPLAY
/tmp/launch-XXXX/:0

[mac]$ xhost +remoteLinux.com
[mac]$ ssh -X user@remoteLinux.com
[linux]$ echo $DISPLAY
localhost:10.0

[linux]$ setenv DISPLAY <ip of mac>😮.0
[linux]$ xterm
xterm Xt error: Can't open display: <ip of mac>😮.0


The issue seems to be with the Mac running 10.5.7 because from my MacBook Pro (10.4.11) I can connect and launch xterms, xapps with no problems. I've edited ssh_config and sshd_config to allow X11 forwarding and it makes no difference. Am I missing something obvious? There must be some configuration setting that needs to be modified but can't find anything anywhere. Any suggestions would be greatly appreciated.

Mac OS X (10.5.7)

Posted on Jun 19, 2009 1:01 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 19, 2009 3:51 PM

You DO NOT need xhost
You DO NOT need to set your own DISPLAY
You DO NOT need to mess with any config files.

The *ssh -X* is doing all the work. The localhost:10.0 was setup by the *ssh -X* option. This is an ssh tunnel for all your X11 traffic back to your Mac.

I use *ssh -X* every day at work talking to Linux boxes.

At worse, you might need to replace the -X with a -Y if the remote system is untrusted.
11 replies
Question marked as Top-ranking reply

Jun 19, 2009 3:51 PM in response to buckydoc

You DO NOT need xhost
You DO NOT need to set your own DISPLAY
You DO NOT need to mess with any config files.

The *ssh -X* is doing all the work. The localhost:10.0 was setup by the *ssh -X* option. This is an ssh tunnel for all your X11 traffic back to your Mac.

I use *ssh -X* every day at work talking to Linux boxes.

At worse, you might need to replace the -X with a -Y if the remote system is untrusted.

Jun 30, 2009 7:53 AM in response to buckydoc

Folks,
I think I found the problem and a solution.
After reading the following 2 items:
http://developer.apple.com/opensource/tools/runningX11.html
http://iparrizar.mnstate.edu/~juan/urania/2009/05/28/xquartz-on-macos-x-for-the- astronomer/

It looks that apple is migrating from X11 to Xorg it the latest Leopard versions (10.5.6 and 10.5.7)
More, when using http://xquartz.macosforge.org/ it's even more Xorg than before.

It seems thing got somehow reset to certain defaults with the 10.5.6 and/or 10.5.7 for Xorg and/or Apple's X11 somehow.

In a terminal do: "defaults read com.apple.x11" and "defaults read org.X.x11" (resp. Apple's X11 <10.5.6 and the X that comes IMHO with 10.5.6 or 10.5.7 and xquartz

There are for both options available and one of them is "nolisten_tcp".

From the first link mentioned above (runningx11) I distilled the following 2 terminal commands:
(on that page it says you can do this also with the X11 prefs, but I didn't test that)

defaults write com.apple.x11 nolisten_tcp -boolean false
defaults write org.X.x11 nolisten_tcp -boolean false

Restarted X....

Well,... my X on 10.5.7 is working again. with the xhost and DISPLAY variable mechanism.

Hope this helps
my 2 cents

Jun 28, 2009 6:58 AM in response to buckydoc

Are you still setting your own DISPLAY?
linux$ setenv DISPLAY <ip of mac>😮.0

Or are you using the DISPLAY environment variable established by ssh via the -X or -Y options.

In my previous reply, it looked to me you were doing good right up until you change DISPLAY and then tried using xhost.

I just *ssh -X* into my Linux box and that is all I need to do. DISPLAY is correctly setup by ssh. My DISPLAY generally looks like localhost:10.0 or some similar 10, 11, 12, ... display number. This is the local end of an ssh tunnel back to my Mac.

When you changed your DISPLAY environment variable, you totally bypassed all the work ssh did to make displaying X11 windows on your Mac easy.

Jul 15, 2009 5:18 PM in response to NomadaNare

I'm still having problems even after the setting the "nolisten_tcp" to false. When I remote login to another mac, all running 10.5.7, I can't run a remote X11 window (e.g., xeyes). Things were working fine previously, so I assume this is something specific to 10.5.7. ForwardX11 yes is set on each machine. Doesn't matter if I log in with -X or -Y. I get the "Error: Can't open display" message. Any additional suggestions are greatly appreciated.

Jul 17, 2009 10:55 AM in response to buckydoc

To allow me to ssh into my Mac Pro with 10.5.7 and run x applications (xclock, for example), all I had to do was change the sshd_config file to enable the "forward" lines.

I didn't have to do the other stuff with "defaults". In fact, typing those commands gave an error.

I'm ssh'ing into the mac pro from a windows computer, using putty, with X11 tunneling enabled.

Sep 23, 2009 2:07 AM in response to buckydoc

I was having the same problems.
Wanting to connect my OSX macbook to a linux server.
The solution is as others have said. Add the forwarding command to the config files, and connecting with ssh -X user@remoteserver

Last step for me was to restart the ssh server, so that the config change would take effect. On my debian linux server, "/etc/init.d/ssh restart", or be low tech and just reboot 🙂

Problems with X11 - Can't open display

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.