NERSC logo National Energy Research Scientific Computing Center
  A DOE Office of Science User Facility
  at Lawrence Berkeley National Laboratory
 

Using MacX to Connect to NERSC

Note: This information is relevant to the pre-OS X versions of the Macintosh Operating System, OS 9 and previous. For OS X, the general instructions in the page Using X Applications at NERSC are applicable.

MacX is an X-Windows display server application for Macintosh computers. It is an Apple product. Other X-Windows display server applications exist for Macintosh computer, but this document does not deal with them. Only a little of what must be done to make MacX operate is specific to the Mac workstation platform. Much of what must take place is generic to X-Windows on all platforms, and to all display servers or window managers. Many of these terms will be defined in the paragraphs below.

Getting Started

To use X-Windows to provide virtual terminal connections to NERSC mainframes, a two-step procedure must be followed:

  1. Connect to the desired NERSC mainframe via "ssh" and log in.
  2. Execute, on the NERSC mainframe, the desired X-Window command, such as "xterm", and direct display back to the workstation you wish to see the window on.

What is an X-Terminal (X-Windows Virtual Terminal)?

X-Window virtual terminals are software implementations of X-Windows computer terminals. These software windows, commonly called "X-Terms", display their contents on hardware displays of many types (PC's, Unix workstations, etc.). X-Terms are completely configurable, in size, shape, color, font, etc. Some standard hardware terminal types can be emulated by X-Terminals, including Tektronix graphic terminals. However, the X-Window system defines a well understood software terminal, generically referred to as an "xterm" that includes all the control protocol necessary to emulate a wide variety of software devices, including clocks, machine load monitors, and mailbox indicators (aka "biffs").

What Do I Need to Know About All This To Make It Work?

Man Pages

Only a little knowledge is needed to make all the above work. X-Windows is a very widely accepted display system, and every Unix system that supports it has extensive man pages for each of its components. For instance, type "man xterm" to learn about the "xterm" software terminal.

Clients, Servers, and Windows

To make X-Windows work, a piece of software must run both at the mainframe (called, in this context, a "client application"; "xterm" is one) and at the workstation (called a "display server"; MacX is an example). Note that this terminology may be reversed from the norm, since the "server" runs on your workstation, while the "client" runs on a distant, possibly more powerful machine. On Unix systems, there are numerous display servers that compatible with basic X-Windows; some of these add functionality to the X-Windows system, and are called "window managers". MacX is, in fact, a window manager.

MacX Documents and Commands

MacX is a Macintosh application. Its documents are each complete windowing environments, including sets of "remote commands" that can be sent to remote computers, and have their results displayed on the originating Mac. These commands are of the sort mentioned, above, such as "xterm" and "xclock", and can include as many of the appropriate options as the user desires. However, since NERSC does not allow its mainframes to accept remote commands, the two-step procedure shown above is necessary: first connect to the mainframe; then run the X command, with display directed back to your workstation.

Specifying a Display

The matter of "directing display back to your workstation" is significant. There are two common ways to do this. First, set an environment variable on the mainframe you wish to connect to your Mac. Do this by typing

setenv DISPLAY <workstation>

in the shell, once you are logged on. This command can also be put in a shell control file, such as your ".cshrc" file. The <workstation> specifier is either the completely resolved domain name of your workstation, followed by ":0.0", or the IP Address of your workstation, followed by ":0.0". Here's are examples of the two ways to set a display environment variable:

setenv DISPLAY highline.lbl.gov:0.0
setenv DISPLAY 128.3.9.33:0.0

Note that if your workstation's IP Address changes, as in some dial-up contexts, using its name will work best and easiest. The other way to direct display from an X command to your workstation is to use the "-display" option that's part of every X command. Here are two examples of how to do this with the "xterm" command:

xterm -display highline.lbl.gov:0.0
xterm -display 128.3.9.33:0.0

Xterm Commands and Options

There are lots of other options to any X command, as can be seen in their man pages. A good way to control this complexity is to experiment with the commands you use often, such as "xterm", until you have a pleasing display, then put the command and its options in a shell script. Save the script file on the mainframe you want to work on, so that after you connect in step 1, above, you can execute the shell script and get all the displays you want in the forms you want them. Here's an example shell script file I use on Jacquard:

#!/bin/csh -f

xterm -fg blue -bg white -ls -fn 8x13 -title "Jacquard" \
-sb -sl 200 -geometry 100x50+0+19 -iconic \
-xrm  "XTerm*iconGeometry:+314-115" -xrm "XTerm*iconName:Jacquard" &

xterm -fg blue -bg white -ls -fn 8x13 -title "Jacquard" \
-sb -sl 200 -geometry 100x50-0+19 -iconic \
-xrm  "XTerm*iconGeometry:+351-115" -xrm "XTerm*iconName:Jacquard" &

The first line specifies that the shell script will be executed by "csh" (the C shell).

The rest of the lines are two xterm commands, that generate large virtual terminals on my screen. These "xterms" show up in "iconic" form, which means they are shrunk down to two small icons, that can be expanded into large screen displays when I wish. Their size, shape, location, icon size, icon shape, icon location, font size, color, and title identification are all specified as options in these two commands. They are also set up as scrollable windows, each with 200 lines of scroll buffer. Note that each command ends with an "&". This tells the shell to run the commands in the background, which is necessary if all of them are to run and return control to the telnet session's login shell when the script is done executing.

SPECIAL NOTE: The scripting method described above generates xterm processes on a remote computer (e.g. Jacquard) which send their displays to a workstation. The xterm processes can become orphaned if MacX crashes or terminates without killing them. Orphaned processes can tie up mainframe system resources, which can be released only by manually killing the offending processes. Good citizenship demands that such housekeeping be attended to regularly. For more information on this, see the mainframe man pages for the commands "ps" and "kill".

Using Emacs with MacX

Finding the "alt" and "meta" Keys

Since Macintosh keyboards do not have "alt" and "meta" keys, and since Mac software prefers to interpret the Mac "Option" and "Command" keys differently from Emacs' use of "alt" and "meta", the MacX software allows the use of the up-arrow and down-arrow keys for these purposes. To see how to set these keys up, select the "Misc. Preferences" item under the MacX "Edit" menu.

Simulating a Three-Button Mouse

Since Macintoshes are do not normally have three-button mice, the Mac's single mouse button acts like the left button of a three-button mouse, under MacX, and MacX allows the keyboard's right and left arrow keys to simulate the middle and right buttons of a three-button mouse. Three-button mice are available for Macs from aftermarket suppliers.) The setup for these keys and mouse buttons is also done in the "Misc. Preferences" item of the MacX "Edit" menu.

Changing Fonts

To change the fonts used in a Xterm window in general or an Emacs window in particular, you need to press the control key and the right mouse button in the xterm or Emacs window. In the MacX setup, that is probably Ctrl-Rt-arrow or Dn-arrow+Rt-arrow. this will give you a popup menu of fonts; move the mouse cursor to the one you want and release all buttons. Some fonts may be unavailable, depending on the set of fonts you have installed in your system and available to MacX.

Changing Window Styles

To change a MacX window size, you will need to have resizeable windows (Mac-style, with a zoom box on th eeupper right corner and a growth box in the lower right). To change from an unresizeable MacX window to a resizeable one, either use the "Windows Preferences" item in the "Edit" menu, or select "Set Window Style" in the "Window" menu. The former affects all MacX windows opened subsequently, while the latter affects only the currently active MacX window.


LBNL Home
Page last modified: Wed, 05 Oct 2005 15:52:19 GMT
Page URL: http://www.nersc.gov/nusers/help/access/macx.php
Web contact: webmaster@nersc.gov
Computing questions: consult@nersc.gov

Privacy and Security Notice
DOE Office of Science