9.8. Virtual Network Computers
One of the attractive features of Mac OS X is the ease with which you can integrate a Mac OS X system into a Unix environment consisting of multiple Unix workstations that typically rely on X11 for their GUI. In the previous section, for example, we explained how to log in to a remote Unix machine, launch an X11 application, and display the application on your Mac. The reverse process is also possible. You can log into a remote Mac OS X machine from another computer, launch an application on the remote Mac OS X machine, and have the application display on your local machine. The local machine, meanwhile, can be running the X Window System, Microsoft Windows, or any another platform supported by Virtual Network Computer (VNC).
VNC consists of two components: a VNC server (which must be installed on the remote machine) and a VNC viewer (which is used on the local machine to view and control applications running on the remote machine). The VNC connection is made through a TCP/IP connection.
The VNC server and viewer may not only be on different machines, but they can also be installed on different operating systems. This allows you to, for example, connect from Solaris to Mac OS X. Using VNC, you can launch and run X11 applications on Mac OS X, but view and control them from your Solaris box.
VNC can be installed on Mac OS X with the Fink package manager (look for the vnc package), but that version (the standard Unix version of the VNC server) only supports X11 programs, not Aqua applications. VNC translates X11 calls into the VNC protocol. All you need on the client machine is a VNC viewer.
The standard Unix version of the VNC server is quite robust. Rather than interacting with your display, it intercepts and translates the X11 network protocol. (In fact, the Unix version of the server is based on the XFree86 source code.) Applications that run under the Unix server are never displayed on the server's screen. Instead, they are displayed on an invisible X server that relays its virtual display to the VNC viewer on the client machine.
9.8.1. Launching VNC
If you installed VNC via Fink, you can start the VNC server by issuing the following command:
You will need to enter a password, which you supply when you connect from a remote machine. (This password can be changed using the command vncpasswd.) You can run several servers; each server is identified by its hostname with a :number appended. For example, suppose you start the VNC server twice on a machine named abbott; the first server will be identified as abbott:1 and the second as abbott:2. You will need to supply this identifier when you connect from a client machine.
By default, the VNC server runs twm . So, when you connect, you will see an X11 desktop instead of the Mac OS X desktop. (You can specify a different window manager in ~/.vnc/xstartup.) To terminate the VNC server, use the following command syntax:
vncserver -kill :display
For example, to terminate abbott:1, you would issue the following command while logged into abott as the user who started the VNC server:
vncserver -kill :1.
9.8.2. Connecting to the Mac OS X VNC Server
To connect to a Mac OS X machine that is running a VNC server, you will need a VNC viewer. Viewers are available for Mac OS X; a list can be found on Version Tracker (http://www.versiontracker.com/macosx/) by searching for "VNC".
If you want to connect to a VNC server from your Macintosh, there are several VNC viewers available for Mac OS X, including:
To connect, start your viewer and specify the hostname and display number, such as abbott:1 or abbott:2. If all goes well, you'll be asked for your password, and then connected to the remote Mac OS X desktop.
Copyright © 2003 O'Reilly & Associates. All rights reserved.