skip to main content NIST Center for Neutron Research NIST Center for Neutron Research National Institute of Standards and Technology
Home Live Data Instruments CHRNS Proposals
EXPGUI home


Installing GSAS/EXPGUI under Mac OS X

This page contains information on installing and running GSAS & EXPGUI on Macintosh OS X computers.

Installation

Both GSAS and EXPGUI require that X-windows (X11) be installed on your Mac. Since 10.3, this has been distributed as part of the operating system, but is not loaded as part of a default installation. The instructions below describe how X11 is installed.

  1. Install X11
    Before you can run the GSAS package (or, for that matter, a large number of other Unix-derived graphics applications), you need to load the X Windows system (X11) onto your computer.

    For 10.4, one can load the Mac OS X install disk. Note that this requires administrator access to the computer. The X11 installation procedure consist of the following steps:

    • On the finder window for the DVD, scroll down and double-click on the Optional Installs icon, which starts the installer.
    • Proceed through the windows by pressing Continue (note that X11 must be installed on the boot disk).
    • On the package list page, click on the arrow next to Applications to open the list, then select X11 to be installed by clicking in the box to the left and click Install.
    • The installation then begins.
    • When installation is complete, the X11 package can be run from the utilities menu of the system Applications folder.
    See the page on Installing X11 under Mac OS X for more details.

    For 10.3 (Panther) I am pretty sure a similar process to 10.4 can be used, but I don't have access to a machine that can boot that OS. Alternately, if you have OS X 10.3 on CDROMs, insert CDROM #3 and then click on the Packages folder and within that folder, click on X11User.pkg. Read the installation screens, click on the "next" button a few times, and X11 is installed.

    For 10.2 (Jaguar), X11 installation is not simple, so you will need to do some searching on the web, find a guru or consult one of the many Mac OS X books that cover this subject. One should strongly consider an OS upgrade instead.

  2. Download the GSAS & EXPGUI programs as a Mac disk image appropriate for the CPU type of your computer (to find out what you have click on the "About This Mac" item in the Apple menu).
    Mount the downloaded file by double-clicking on it. This should create a new volume in your top-level ("Computer") called "GSASvol"; clicking on this device will open a finder window with a single folder ("gsas") present. (Note that some browsers will automatically perform this step for you.)

    While you can run GSAS & EXPGUI from this location, you are strongly suggested to instead copy the entire package to your computer by dragging the gsas folder icon to another finder window, or by clicking on it and using Copy and Paste.

  3. Install a "shortcut" to launch EXPGUI
    EXPGUI AppleScript icon The OS X version of GSAS & EXPGUI has an EXPGUI AppleScript application named expgui.app in the gsas folder with the icon shown to the right. This AppleScript will start X11, if needed and then lauch EXPGUI. (If you have ideas for improving the script, the code can be found in file expgui_applescript.txt.) The EXPGUI AppleScript can be used in three ways:

    • Double-clicking on the icon will launch EXPGUI so that it starts with the "file open" window in your home directory. This window can then be used to navigate to access/create experiments in other folders.

    • Dropping one or more GSAS Experiment (.EXP) files onto the EXPGUI icon will cause the experiment files to be opened. If more than one file is dropped, each file will open in a separate EXPGUI session.

    • Dropping one or more folders onto the EXPGUI icon will cause EXPGUI to be started with the "file open" window in that folder.

    If you will use GSAS a fair amount, you will likely find it convenient to drag the EXPGUI icon to the dock for easy access.

    Note, that this EXPGUI app will not work correctly if copied or moved to another folder. It must be located in the gsas folder along with all the other files and subdirectories needed by GSAS & EXPGUI -- you can instead create an alias (by highlighting the AppleScript icon in the Finder and using the File/"Make alias" menu item or the Command-L shortcut). An alias created in this fashion can be moved wherever desired -- for example, to the desktop or to the Application folder.

  4. For Unix power users: Make a command line shortcut (optional)
    People who have not become completely enlighted to the Mac may wish to set up a way to type something (gasp!) in a terminal window that will allow them to start EXPGUI. There are a number of ways this can be done, (see section 2.2 in the Unix installation notes.) Also, on the Mac it is possible to add applications to the X11 Applications menu, by using the Applications/Customize menu option. Note that the command used to start Tcl/Tk and EXPGUI will vary depending on where you installed the package. I install the package in ~/Applications so the command string to start EXPGUI is:
              ~/Applications/gsas/ncnrpack-osx  ~/Applications/gsas/expgui/expgui
    


EXPGUI Enhancements specific to the Mac

EXPGUI will automatically designate the EXPGUI AppleScript as the "open with" application for every GSAS experiment (.EXP) file that is read or written by EXPGUI. This is done with the Development Tools program Rez, found in /Developer/Tools or in the gsas folder. At the same time, EXPGUI will also set an icon for the .EXP file. After this has been done, EXPGUI can be invoked by simply double-clicking on a GSAS experiment file (.EXP file) icon.

If for some reason you would prefer this not be done (I would be interested to hear why) -- deselect the "Assign app to .EXP files" checkbox in the Options menu.



Mac ideosyncracies

Unlike in the Windows & Unix versions of GSAS, Mac windows may not be updated until they are brought to the top of the screen by clicking on them (given focus). This is most noticible for PGPLOT graphics (in POWPLOT, RAWPLOT,...). When you type graphics commands in a terminal window, the plot does not appear to change. However, click on the PGPLOT's window bar and the plot will update.



The Tcl/Tk Starkit

The GSAS-EXPGUI distribution now includes a single file version of the entire Tcl/Tk package, as well as a graphics package for Tcl/Tk, called BLT, that is used extensively within EXPGUI. The inclusion of this file within the package simplifies installation considerably. This single 3 Mb file, gsas/ncnrpack_osx, contains many other Tcl/Tk packages (that are not used within EXPGUI) and may be of value for use with other applications. Note that the EXPGUI AppleScript will look for Tcl/Tk first as the ncnrpack_osx file in the same folder as where the expgui.app script is located. If this ncnrpack_osx file is deleted, renamed or moved, then the script will look for the standard Tcl/Tk program (wish) in the /sw/bin directory.



Problems

If you cannot get EXPGUI or the GSAS graphics programs to work, you may have a setup problem with X-windows (X11). One common reason for this is that X11 must be restarted any time your computer's hostname changes, which may be caused by starting/stopping networking, dialing in for e-mail or even by a change in IP address initiated by the network DHCP server, if you are hardwired into a network. If exiting and restarting X11 does not address your problem, the following paragraphs may help you diagnose problems.
  1. One possible problem is the definition for the X11 display (shell environment variable DISPLAY). On my machine, this variable seems to be set correctly in X11 xterm windows, but is not set by default within an Aqua terminal window unless you make changes to your shell startup.

    A quick test for X11 problems is to type xclock at the shell prompt:

         bash-2.05a$ xclock
    
    If you get a clock display -- great, X windows is working!

    If you get the following error message the DISPLAY variable is not set:

         bash-2.05a$ xclock
         Error: Can't open display: 
    
    If on the other hand, you get this error message, there is a security problem with X windows:
         bash-2.05a$ xclock
         Error: Can't open display: localhost:0.0
    
    This will most likely be solved by exiting and restarting X11 (see above).

    You can set the DISPLAY variable in bash/zsh, etc. using:

         bash-2.05a$ export DISPLAY=localhost:0.0
    
    or in csh/tcsh, etc. using:
         [d120234:~] toby% setenv DISPLAY localhost:0.0
    
    (For info on how to do this automatically, see step 2 in http://www.chemistry.ucsc.edu/~wgscott/xtal/page1.html).

  2. A second possible problem relates to the installation of the Tcl/Tk and BLT packages. This problem seems unlikely, now that the Tcl/Tk package is included in the distribution, but if you have removed the ncnrpack_osx file from the gsas folder, the expgui.app AppleScript will try to use wish installed in /sw/bin. If you are choosing to do this, you can test if Tcl/Tk and the BLT package are installed correctly using the following commands:
         [d120234:~] toby% wish
         % package require BLT
         2.4
         % pack [blt::graph .g]
         % exit
    
    When you type "wish" and press Enter, a new small blank window should appear. when you type the 2nd line, "package require BLT," there will be no change in the blank window, but the computer should respond "2.4". After the "pack [blt::graph .g]" command is entered, a set of x- and y-axes should appear in this window. The window should disappear after "exit" is typed.


The EXPGUI icon, the original version of the EXPGUI AppleScript and help with this documentation was provided by Francois Farges -- many thanks!

Thanks to Paul Kienzle of the NCNR DAVE project for providing the "all in one file" (starkit) version of Tcl/Tk for OS X.

GSAS is Copyright, 1984-2000, by the Regents of the University of California. The GSAS software was produced under a U.S. Government contract (W-7405-ENG-36) by the Los Alamos National Laboratory, which is operated by the University of California for the U.S. Department of Energy. The U.S. Government is licensed to use, reproduce, and distribute this software. Permission is granted to the public to copy and use this software without charge, provided that this notice and any statement of authorship are reproduced on all copies. Neither the Government nor the University makes any warranty, express or implied, or assumes any liability or responsibility for the use of this software.

EXPGUI was created by a (former) U.S. Government employee, which means that EXPGUI is not subject to copyright. Have fun with it. Modify it. Please write new sections and make them available to the rest of the world.

Neither the U.S. Government nor any author makes any warranty, expressed or implied, or assumes any liability or responsibility for the use of this information or the software described here. Brand names cited herein are used for identification purposes. Mac computers are the best, but this does not constitute an endorsement by NIST.



$Revision: 1.11 $ $Date: 2007/01/25 22:57:44 $