remote x11 display - HELP

Discussion in 'Mac Apps and Mac App Store' started by switcher22, Sep 11, 2004.

  1. switcher22 macrumors newbie

    Joined:
    Oct 14, 2003
    Location:
    Winnipeg, MB
    #1
    I am trying to view X11 applications from an UNIX server on my Mac. I've tried downloading a VNC viewer client (VNC Dimentions), but so far no luck.

    I've also heard that you can do it directly through Terminal.

    If anyone can help me out (step by step instructions would be a plus) with this that would be great.

    Thanks
     
  2. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #2
    First thing you need to do have X11 running on your Mac. It's in Utilities (assuming it's installed).

    Then you need to connect to the Unix server with ssh (you do this from the command line, using Terminal). By default the Mac won't have X11 forwarding turned on, so you'll need to turn it on. You can either do this when you run ssh:

    Code:
        ssh -X [i]remote_host_name[/i]
    
    ... or else you can turn it on permanently in your config file. Simplest way to do the that is to create a file named "config" in the .ssh directory that's in your home directory (/Users/yourname/.ssh), and put the following lines in it:

    Code:
        ForwardAgent    yes
        ForwardX11      yes
    
    Once you're connected to the remote server, just type the name of the X11 app - that's it! If it doesn't work, it's quite possible the admin of the server has X11 forwarding turned off. Unless that admin is also you, there's not a lot you can do about it other than beg him/her to turn it on.

    Edit: Note that VNC really has nothing to do with X11. VNC is a tool that lets you view/control a desktop that's running on a remote computer. It could be an X11 desktop, but it could also be a Windows or OS X desktop. Also, it's not a very secure way to do things unless you tunnel your VNC session through ssh - but that's another story. :D
     
  3. tomf87 macrumors 65816

    tomf87

    Joined:
    Sep 10, 2003
    #3
    Also you will want to run those commands above from X11, not from Terminal. When you first launch X11, it will bring up xterm, which would be X11's flavor of Terminal.
     
  4. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #4
    As long as X11 is running and you have the DISPLAY variable set, you can use any terminal app you want. I'd forgotten, though, that DISPLAY isn't set by default in terminal.

    Some time ago I added the following code to my .bashrc file, so I didn't have to worry about it anymore - especially since I've always got X11 running:

    Code:
    if [ x"$DISPLAY" == x"" ] ; then
       export DISPLAY=":0.0"
    fi
    
     
  5. tomf87 macrumors 65816

    tomf87

    Joined:
    Sep 10, 2003
    #5
    I never really knew how to set my display variable through scripting. Since xterm set it automagically, I just used it instead.

    Here's something that is annoying me in xterm though: the path. The path variable isn't the same in xterm as in terminal. Essentially, I use Fink and the /sw/bin isn't included in the xterm path. Know where I can set that?
     
  6. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #6
    You need to add the following line to your .bashrc file:

    Code:
    source /sw/bin/init.sh
    Fink's installer tries to do it, but at least when I installed fink it failed to do it (and reported that fact).

    You can put any environment changes into .bashrc, including modifications to $PATH. At the end of mine I've got the line above, and then after it one more line:

    Code:
    export PATH=$HOME/bin:$PATH
    That way anything I put in the "bin" directory that's below my home directory (~/bin/) will get executed before anything else with the same name. I don't use that so much under OS X as I used to under Linux; but if you've got custom shell scripts you like to run that's a good location for them - for one thing they'll get backed up whenever you back up your home directory. :)
     

Share This Page