Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

switcher22

macrumors newbie
Original poster
Oct 14, 2003
20
0
Winnipeg, MB
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
 

Westside guy

macrumors 603
Oct 15, 2003
6,342
4,160
The soggy side of the Pacific NW
switcher22 said:
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.

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
 

tomf87

macrumors 65816
Sep 10, 2003
1,052
0
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.
 

Westside guy

macrumors 603
Oct 15, 2003
6,342
4,160
The soggy side of the Pacific NW
tomf87 said:
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.

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
 

tomf87

macrumors 65816
Sep 10, 2003
1,052
0
Westside guy said:
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

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?
 

Westside guy

macrumors 603
Oct 15, 2003
6,342
4,160
The soggy side of the Pacific NW
tomf87 said:
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?

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. :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.