NCL > Download

Running NCL under MacOSX

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


Install XQuartz

XQuartz is an X Window System that enables you to display graphics to your screen if you use "x11" as the graphical output option when executing ncl scripts.

To test if you can display X11 graphics via an NCL script, open a Terminal window and type:

    ng4ex xy01n -clean

This should start XQuartz and pop up a window with an XY plot. Left-clicking on this window will make it go away.

If you don't get a window and you get an error, then you may need to install XQuartz. Go to http://xquartz.macosforge.org/ and click on the "XQuartz-x.y.z.dmg" link. This should cause the file to be download, likely into 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 clicking on the icon should start the installation. We recommend you accept all the defaults during the installation questions.

Once XQuartz is installed, you can remove the "XQuartz-x.y.z.dmg" file. You may need to logout and log back in order for XQuartz to work properly. You can then try the "ng4ex" command again.

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.


Install gcc and gfortran

The "ncl" executable will likely have gcc and/or gfortran library dependencies, so you need to install these compilers.

Open a Terminal window and type the following commands to check if you already have gcc and/or gfortran installed, and to see what version you are running:

   which gcc
   which gfortran
   gcc --version
   gfortran --version

If you don't have them installed, then there are several ways you can get gcc and gfortran installed on your Mac. Here are two 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/.

  3. Use a package manager like Mac Ports or Homebrew to install the compilers (these are also great for installing other software you might need, like ImageMagick)


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

Follow these instructions to get to the list of available NCL binaries.

Here's the direct link: NCL 6.3.0 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. Click on the "Download Individual Files" button.
  7. 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.11.6
  x86_64

This would mean you need to download this binary:

  ncl_ncarg-6.3.0.MacOS_10.11_64bit_gcc530.tar.gz


Install (and test) NCL from downloaded binary

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


Missing "___emutls_get_address" symbol with "ncl"

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

   dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address

then it is likely because you have an older version of the gcc/gfortran compilers on your system than what NCL was compiled with.

You can determine what version of gcc your NCL was compiled with by the name of the precompiled NCL binary file that you downloaded. For example, in the file "ncl_ncarg-6.3.0.MacOS_10.9_64bit_gcc492.tar.gz", the compiler version is 4.9.2.

To see what default version of gcc you have on your own system, type "gcc --version" on the UNIX command line. You may have other versions of gcc installed on your system, so look for these first, or check with your system administrator. They might be in directories like "/usr/local/bin" or "/opt/local/bin".

If your gcc is older than the one used to compile NCL and you can't find any newer versions, then you need to install the newer compiler. You can still keep your older compiler, as the newer one can be installed to a separate directory. Here are a couple of options for installing gcc/gfortran. We recommend the first one, via HPC sourceforge:

  1. Download gcc/gfortran from http://hpc.sourceforge.net/.
    This installation will put the compilers in /usr/local.

  2. Use Homebrew to install a newer compiler:

      brew install gcc48
    

    The final step that you might need is to set the environment variable "DYLD_FALLBACK_LIBRARY_PATH" in one of your .* files, (like ".tcshrc", or ".profile", or ".bashrc"). HOWEVER, this is generally NOT recommended. Only do this as a last resort. Some examples:

       setenv DYLD_FALLBACK_LIBRARY_PATH /opt/local/lib/gcc48
    or
       export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib/gcc48
    


    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
    

    then it is likely because you have an older version of the gcc/gfortran compilers on your system than what NCL was compiled with. See the above section which explains how to install a newer compiler, which should then get you the missing "libgomp.1.dylib" library. After installing the new compiler, it should be in a directory like "/usr/local/lib".


    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. Use your spotlight search feature to see if you can locate this file.

      If you find the file, then note the location of it. It may be necessary to set the environment variable DYLD_FALLBACK_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.