Terminal wedged: "Can't open display: :0.0"

My X11 just crashed unexpectedly (a very rare occurrence, until
recently), and after restarting it, I'm no longer able to start
X11 programs from Terminal. I killed and re-started both Terminal
and X11, for good measure, but still I get the same error in
Terminal; e.g.:

% echo $DISPLAY
% xlogo
Error: Can't open display: :0.0

Strangely, if I start xlogo directly from X11's Applications->xlogo
menu, the xlogo window pops up fine.  So clearly the problem is
not with X11; it's running fine.  I figure that the DISPLAY variable
in my Terminal shell is set wrong.

The big question now is how to find the value for this variable
that corresponds to the display that X11 is currently using.

Any suggestions?

I've had this problem (leading to a "loss" of the DISPLAY variable)
occur twice in the last few days, and I'd really like to find a
fix that does not involve re-starting my machine every time.



P.S. I had hoped that if I started an xterm session via X11's
Applications->xterm menu, its DISPLAY variable would be set to the
correct value, but no luck: even in this case DISPLAY is set to
1/25/2010 7:10:03 PM
comp.sys.mac.system 33446 articles. 2 followers. jfmezei.spamnot (9455) is leader. Post Follow

3 Replies

Similar Articles

[PageSpeed] 34

kj wrote:
> % echo $DISPLAY
> :0.0
> % xlogo
> Error: Can't open display: :0.0

The way Apple structured the X11 startup, when X11 isn't running, th
display needs to point to some location that causes X11 to start up,
after which :0.0 will work.

If you start X11.app , it should then have X11 running, and :0.0 should

If I start "Terminal":

bike:~ $ echo $DISPLAY

1/25/2010 7:53:32 PM
Did you find a fix ? I think I am having the same problem !
2/24/2010 12:10:46 PM
In article <xrednSLESNzZihjWnZ2dnUVZ_hednZ2d@giganews.com>,
 Ileana Blade <user@compgroups.net/> wrote:

> Did you find a fix ? I think I am having the same problem !
> ---
> frmsrcurl: 
> http://compgroups.net/comp.sys.mac.system/Terminal-wedged-Can-t-open-display-0
> .0

In Leopard and Snow Leopard the DISPLAY environment variable 
should already be defined.  For example:

    echo $DISPLAY
    /tmp/launch-Pq6WiM/:0   # this is just an example

If you are specifying "export DISPLAY=:0.0" yourself, then it will 
not work.

If you are attempting to setup DISPLAY on a remote system that 
points back to your Mac, then use

    ssh -X username@remote.system.address
    ssh -Y username@remote.system.address

Which will create a DISPLAY environment variable on your remote 
system which routes your X-Window displays back to your Mac.  You 
should not need to define your own DISPLAY environment variable.

                                        Bob Harris
2/25/2010 2:32:37 AM