in reply to Tk OSX couldn't connect to display :0

Aside from making sure that X11.app is running, check that you can run another X program from a Terminal window (say xterm and/or xhost). Some things can confuzzle the xauth authentication, such as disappearing network connections (disconnecting from a WiFi network, or disconnecting a modem connection).

  • Comment on Re: Tk OSX couldn't connect to display :0

Replies are listed 'Best First'.
Re^2: Tk OSX couldn't connect to display :0
by chargrill (Parson) on Nov 26, 2006 at 22:00 UTC

    Indeed.

    I don't recall if it's actually necessary on OSX, but some time ago I ended up putting the following in my .profile or .bashrc so I never have to think about it ever again:

    export DISPLAY=localhost:0.0


    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

      Which could be OK in your case, but if you use ssh and X forwarding, your exported DISPLAY will overwrite the special one that ssh gave you.
      The result will be that your X app will try to run on the machine that you ssh'd to instead of the machine that you ssh'd from.
      Usually not what you want.

      non-Perl: Andy Ford

        That would indeed jump up and bite me in the rear if I were to ever SSH into the box where I have added that to my .bashrc - so sage advice to be sure.

        In this case, it's my laptop - and if my laptop isn't the box closest to me, it's not on, and thus un-ssh-to-able :)

        I do ssh out to a remote FreeBSD host, occasionally with X forwarding, and works as I intend.



        --chargrill
        s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)

        If you set it in ~/.MacOSX/environment.plist (if you don't already have one you can use the developer tools GUI property list editor to create one; it should be a dictionary, the keys being the environment variables to set and the string values the . . . erm . . . values to which to set them). Next time you log in and out (not just a Finder restart; have to go through loginwindow) anything started by the OS X GUI (such as iTerm or Terminal.app) should get those values in its environment.