NCL > Download

Running NCL under MacOSX

This document contains helpful notes on installing running NCL on MacOSX systems.


Install XQuartz

If you are running MacOS 10.8 or higher, then you may be prompted to install XQuartz the first time you run "ncl". This is an X11 server that allows you to display graphics to your screen if you use "x11" as the graphical output option when running "ncl".

For example, when you type:

    ncl -V

for the first time, even though you are not generating any graphics, it still needs to start XQuartz to execute this command. If you don't have XQuartz, then a web browser should automatically pop up with a link to http://xquartz.macosforge.org/.

Click on the "XQuartz-2.7.x.dmg" file (XQuartz was at version 2.7.5 as of November 13, 2013), which will download the "XQuartz-2.7.x.dmg" file and likely put it in your "Downloads" directory.

Navigate your way to this file and double-click on it. This will cause a window with a open box icon to pop up. Double click on the open-box icon, and this should start the installation. We recommend you accept all the defaults during the installation questions.

Once XQuartz is installed, you can remove the "XQuartz-2.7.x.dmg" file. You may need to logout and log back in order for XQuartz to work properly.

If you have questions about these instructions, or if they don't work, then send email to ncl-install@ucar.edu. You need to subscribe first.

Please also visit the section on "Potential issue with displaying graphics to an X11 window".


Install gcc and gfortran

In general, you probably don't need gcc and/or gfortran to run NCL. However, sometimes the "ncl" executable has gcc/gfortran dependencies built in, so these are instructions to help you install gcc/gfortran if there is a dependency.

Open a Terminal window and type the following commands to check if you already have gcc and/or gfortran installed:

   which gcc
   which gfortran

If you don't have them installed, then there are several ways you can get gcc and gfortran installed on your Mac. Here are three of them:

  1. Check if you have a "Developer's Tool" disk that came with your Mac. This may have gcc and gfortran on it.

  2. Download gcc and gfortran from http://hpc.sourceforge.net/.


    Go to list of available NCL binaries on the Earth System Grid

    If this is your first visit to the Earth System Grid, a short registration is required. To register, go to:

    http://www.earthsystemgrid.org

    and look on the right side of the page under "Quick Links" for "Create Account".

    Once you have an account, then following these instructions to get to the list of available NCL binaries:

    1. Open a browser to http://www.earthsystemgrid.org.
    2. Click on "NCL: NCAR Command Language".
    3. Look for the largest NCL version number in the list and click on the link.
    4. Select one of the "precompiled binaries" link, unless you want the source code. Choose the "not OPeNDAP-enabled" link if you don't need OPeNDAP capabilities.
    5. Click on "Download Files".
    6. At this point you will need to login with your OpenID. There are instructions on the page. If you forgot your OpenID or password, then click on the "Forgot your OpenID?" link.
    7. Click on the "Accept License" button after if you've read and agreed to the license.
    8. Click on the "Download Individual Files" button.
    9. Go to the next section on how to choose which binary to download.


    Choose and download the right NCL binary for your MacOSX system

    All MacOSX binaries are 64-bit, even if they have "i386" in the name of the file. This is because they were all built with the "-m64" option with the gcc and gfortran compilers.

    If you're not sure what MacOSX binary you need to download, type:

      sw_vers -productVersion
      uname -m
    

    This will echo something like:

      10.9.2
      x86_64
    

    This would mean you need to download this binary:

      ncl_ncarg-6.2.0.MacOS_10.9_64bit_gcc481.tar.gz
    

    If it echoes something like:

      10.8.0
      x86_64
    

    This would mean you need to download this binary:

      ncl_ncarg-6.1.2.MacOS_10.8_64bit_gcc450.tar.gz
    


    Install (and test) NCL from downloaded binary

    See the "Install NCL/NCAR Graphics from a precompiled binary" document.


    Potential issue with displaying graphics to an X11 window

    If you are running MacOS 10.8 or later, or have upgraded your X11 server to be XQuartz 2.7.4 or earlier, then you may run into an issue with NCL's X11 window in which not all graphics get drawn correctly. This behavior is erratic and each time you run "ncl" you will likely get a slightly different partial graphic showing up.

    We submitted a bug report to XQuartz awhile back and it was fixed in XQuartz version 2.7.5 (as of 11/10/2013). You can get this release from "http://xquartz.macosforge.org".


    Missing "libgomp" issue with "ncl" and/or "ESMF_RegridWeightGen"

    If you are getting the following error when running "ncl" or "ESMF_RegridWeightGen":

      dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib
      Referenced from: /opt/local/bin/ncl
      Reason: image not found
    

    then one user reported that the following steps worked for him:

    1. I installed gcc47 through MacPorts:

        port install gcc47
      

      Another user said he used Homebrew:

        brew install gcc47
      

    2. I set the environment variable "DYLD_FALLBACK_LIBRARY_PATH" in my "~/.tcshrc" like this:

         setenv  DYLD_FALLBACK_LIBRARY_PATH /opt/local/lib/gcc47
      

      In this case, the directory "/opt/local/lib/gcc47" contains the file "libgomp.1.dylib".

      [You can also do this in your "~/.cshrc" or related "dot" file.]

      Another fix may be to upgrade your version of gcc to match the version that NCL (and hence ESMF_RegridWeightGen) was built with. This should be indicated in the binary file name when you downloaded NCL.


      Increase stacksize limits

      Many people running NCL under MacOSX have reported getting segmentation faults on simple scripts. To avoid this, follow one of the steps depending on whether you're running bash (the default) or csh/tcsh:

      For bash, put this in your .profile file:

          ulimit -s unlimited
      

      For csh/tcsh, put this in your .cshrc or .tcshrc file:

          limit stacksize unlimited 
      


      Troubleshooting problems

      • If you try to run NCL, and get an error like:

            dyld: Library not loaded: /usr/local/gfortran/lib/libgfortran.3.dylib
        

        Then this may mean that you don't have the same version of gcc/gfortran installed that NCL was built with. You can first try typing:

          locate  libgfortran.3.dylib
        

        to see if this file is already on your machine. If it is, then you may need to set the environment variable DYLD_LIBRARY_PATH to point to the location of this file.

        Otherwise, if you don't have the file, go to http://hpc.sourceforge.net/ and download the latest version of gcc/gfortran.