Runing linux apps remotely from my PBG4

Discussion in 'Mac Apps and Mac App Store' started by mtp, Sep 19, 2004.

  1. mtp macrumors newbie

    Sep 19, 2004
    Hello All. I have a PowerBookG4 running OS X v10.3.4 and have the following newbie question. Thank you very much in advance!!

    I am using my powerbook in an academic environment and need to run an application (Matlab) that is only available here on a Linux machine in one of the labs. I can of course go to the lab and do the work there, but I'd like to be able to instead log into the machine remotely and then export the graphics back to my local powerbook. In the windows environment I know that I can do what I wish by using an application like Xwin32, which allows the local machine to function as a display server and lets me do all my work on my machine graphically, while the application itself is running remotely on the Linux machine in the lab. I'm fairly new to the mac and not sure how to do this or what application to use.

    If someone could please give some guidance regarding the right software to use to do this, and how I would use that software to do it, that would be really super..

    Thank you very much!!

  2. tomf87 macrumors 65816


    Sep 10, 2003
    You should install X11 for OS X. Then you can SSH into the box at school and run the program and it will appear on your display.

    Keep in mind this is assuming you can access the machine from via SSH.
  3. vasaz macrumors member

    Mar 23, 2004
    You need to install X11 on your powerbook. It might be all ready installed, check the Applications->Utilities folder. If not, pop in the original OS X install dvd, or software restore, and look for it somewhere on there. This is basically like, but allows you to run X windows. You can then SSH into the remote machine and use any graphical apps on it:

    example log in command:

    ssh -l username -X machine.remote.location

    I believe you need to have the '-X' to use a GUI remotely.
  4. mtp thread starter macrumors newbie

    Sep 19, 2004
    Hello. Thank you for your replies....

    I installed X11 and did the used ssh to connect to the remote machine. I then used the following:

    setenv DISPLAY MyIPAddressHere:0.0

    in the hope that it would tell the remote machine where to export the display etc. It accepted this. I then put it to the text with "xterm &", expecting a terminal window to appear....but instead I got the message:

    xterm Xt error: Can't open display: MyIpAddressHere

    Hmmmm...any idea what's going on here??

    Thank you very much!!
  5. vasaz macrumors member

    Mar 23, 2004
    Hmm, I haven't seen that before, but I've never had to set that env var before either. I've always had success just using the command I mentioned previously, so I've never had to change anything. Sorry, maybe someone else can help!
  6. broken_keyboard macrumors 65816


    Apr 19, 2004
    Secret Moon base
    I think by default X window servers only allow programs on the localhost to open windows. Type:

    xhost +

    in a local xterm and then try again. That should disable security and allow remote progs to open windows.
  7. Westside guy macrumors 603

    Westside guy

    Oct 15, 2003
    The soggy side of the Pacific NW
    Okay, here's the problem - this is the wrong display setting. ssh will forward X11 automatically if you set it up AND if the server is set to allow X11 forwarding. When ssh does the forwarding there's an offset; the display value will be something like :13,0. :0,0 will be the local display on the server itself. But you shouldn't ever have to set DISPLAY on the remote machine.

    OS X's ssh is not set by default to forward X11 though. You need to do one of two things:

    - Explicitly tell ssh to forward X11 data with the "-X" switch; or else
    - Set your local ssh config to automatically do this by adding the entry "ForwardX11 yes" either in /etc/ssh_config or in ~/.ssh/config (in the latter case, it can be the only line in the file if you want)

    Before connecting to the remote server, make sure DISPLAY is set on your local computer. You can check this by typing "echo $DISPLAY" from the command prompt. I added the following lines at the end of my .bashrc file to handle this automatically:

    if [ x"$DISPLAY" == x"" ] ; then
       export DISPLAY=":0.0"
    If this all checks out, then just ssh into the remote server and run your program. If it still doesn't work, it's quite possible that the server admin doesn't have X11 forwarding enabled. All you can do in that case is ask nicely - explaining why you need it enabled is a good idea.

    Edit: Please note that, if you try any of the above, the spacing and capitalization matters. (bash shell scripting is very sensitive to spacing, especially around brackets)

Share This Page