
Running NCL under MacOSX
This document contains helpful notes on installing running NCL on MacOSX systems.
- Install XQuartz
- Install gcc and gfortran
- Go to list of available NCL binaries on the Climate Data Gateway
- Choose and download the right NCL binary for your MacOSX system
- Install (and test) NCL from downloaded binary
- Potential issues and their solutions:
- Help us troubleshoot problems
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.Even if you don't plan to use "x11" as an output option, you are still required to have a recent version of XQuartz installed. At the time NCL V6.6.2 was released, XQuartz was at version 2.7.11. You must have this version or later for NCL V6.6.2 to work.
To test if you have XQuartz, use your spotlight icon (the little magnifying glass) or file finder to search for "XQuartz". If you have it, check that the version is 2.7.11 or greater.
If you don't have XQuartz or the version is too low, then go to XQuartz and click on the "XQuartz-x.y.z.dmg" link. This should cause the file to be downloaded, likely into your "Downloads" directory.
Navigate your way to this file and double-click on it. A window with icon that looks like an open box should come up. Double click on the icon to 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.
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. Installing these two compilers will usually get you the required system libraries like "libgomp.x.dylib" and "libgfortran.x.dylib".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 a few ways you can install gcc and gfortran on your Mac:
- Download the appropriate version of gcc and gfortran from
http://hpc.sourceforge.net/.
If you download the "gcc-x.y.bin.tar.gz" file, you will get
both gcc and gfortran.
Note: The MacOS binaries were built with GNU versions 7.x and higher, since many external software packages are depending on newer versions of the software to build properly. For MacOS, you must download 7.x or higher to run the NCL 6.6.2 binary.
We recommend this method, as these are the compilers we use to build NCL.
- If XCode is installed on your Mac, then you may have the "clang" C
compiler, but you will still need the gfortran compiler, because it
provides the "libgomp" library that NCL will need at run-time.
- Use a package manager like
MacPorts
or Homebrew to install the compilers.
These packages are great for installing other software you might need, like ImageMagick.
Go to list of available NCL binaries on the Climate Data Gateway
Follow these instructions to get to the list of available NCL binaries.Here's the direct link: NCL 6.6.2 binaries
- Open a browser to http://www.earthsystemgrid.org.
- Click on "NCL: NCAR Command Language".
- Look for the largest NCL version number in the list and click on the link.
- 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.
- Click on "Download Files".
- Click on the "Download Individual Files" button.
- 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 gcc --version
This will echo something like:
10.12.6 x86_64 gcc (GCC) 7.1.0
This would mean you need to download this binary:
ncl_ncarg-6.6.2.MacOS_10.12_64bit_gnu710.tar.gz
Install (and test) NCL from downloaded binary
See the "Install NCL/NCAR Graphics from a precompiled binary" document.Incompatible library version for "libfontconfig"
If you are getting the following error when running ncl:
Incompatible library version: ncl requires version 11.0.0 or later, but libfontconfig.1.dylib provides version 10.0.0then this is likely due to having an old version of XQuartz. See the "Install XQuartz" section above on how to upgrade your version of XQuartz.
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.6.2.MacOS_10.13_64bit_gnu730.tar.gz", the GNU compiler version is 7.3.0.
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.
Read the Install gcc and gfortran section for some options for installing gcc/gfortran.
The final step that you might need, especially if you used Homebrew or MacPorts to install gcc/gfortran, 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" or "libgfortran" issue with ncl and/or ESMF_RegridWeightGen
If you are getting one or more of the the following errors when running ncl or ESMF_RegridWeightGen:
dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib dyld: Library not loaded: /usr/local/lib/libgfortran.4.dylib
then it is likely because you have an older version of the gfortran compiler on your system than what NCL was compiled with, or you don't have gfortran installed at all.
See the install compilers section above which explains how to install gfortran, which should then get you the missing "libgomp.x.dylib" and "libgfortran.y.dylib" libraries. After installing gfortran, the libraries will be 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
Help us troubleshoot problems
If you have read this whole document and NCL still is not working, then send email to ncl-install@ucar.edu. You need to subscribe first.In your email, tell us which MacOS binary you downloaded from the ESG, and include the output from running all of the following commands on the command line of a Terminal window:
which ncl ncl -V otool -L `which ncl` env | grep NCARG which gcc which gfortran gfortran --version gcc --version