wgrib2 v3.8 Install on Apple Silicon Macs

#wgrib2 #version_3.8 #Installation #MacOS #Sequoia #Sonoma #Tahoe

Posted 01/04/2026 @ 2:05 PM

Updated January 2026- version 3.8

The data of Numerical Weather Prediction Models is most commonly supplied in a “grib2” (gridded binary) file format. (“grib” originally meant from General Regularly-distributed Information in Binary form). Originally, there was grib or grib1. Now, there’s grib2 files.

“wgrib2” is an essential tool used to manipulate grib2 files and it’s used to extract specific weather model parameters, perform calculations, and to create and recreate new grib2 files that cover smaller geographic areas. It has many other uses and it’s been compared to a “food processor” that slices and dices and prepares all sorts of things.

Some Background on the wgrib2 Utility

To work efficiently with very large weather GRIB2 data files, the wgrib2 utility was developed by a team of several NOAA data scientists led by Wesley Ebisuzaki.  It is a command line tool based on C and Fortran programming. 

(Older versions of wgrib2 (3.1.3 and earlier) and the original documentation of wgrib2 are found here: https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/)

wgrib2 is a low level command line application that runs on the Mac’s original underlying Unix-Darwin foundation. The Terminal program (command line) is used to run wgrib2 to manipulate weather model data.

Wgrib2 does not come as pre-compiled downloadable program. (There used to be a pre-compiled version on MacPorts, but I never found that to work.)

Installation and operation is dependent on your Mac’s specific directory structure and the versions and locations of code libraries (“dependencies”) installed on a specific computer. As such, you must download and compile the wgrib2 program for use on a specific computer based on these dependencies and the particular directory structure of your Mac.

wgrib2 3.8 is supplied as as folder of code and code libraries on GitHub. Compile scripts are run to put the program together. Two other larger library compilations (dependencies) must also be downloaded, compiled and installed first.

This guide and tutorial will show you how to do this step-by-step.

Most of this tutorial is geared towards novices with little or no experience in using Terminal commands. More experienced users, please don’t be put off by the hand-holding.

The development of wgrib2 after v 3.13 was moved from NOAA servers to GitHub. The latest version, v3.8, was released Nov 2025.

The main differences between the earlier versions (3.13 and earlier) and the current versions —Newer version are compiled with cmake, not with a makefile and several dependent libraries are no longer included with the wgrib2 download; they must be downloaded and compiled separately and then linked. All software is now on GitHub, as are the dependent libraries. Documentation is also being moved to GitHub.

The new versions are actually easier to install than the older versions.

Read Important Note for users with conda or miniconda previously or currently installed on their Macs.
Apple Silicon vs Intel

This tutorial was designed primarily for Apple Silicon Macs. Older Intel Macs use a different directory structure.

A package manager, “Homebrew“, will be used to install the raw code and the dependent libraries.

An important difference in directory structure between Intel and Apple Silicon Macs:

Homebrew location on older Intel Macs:     /usr/local/homebrew
Homebrew location on new Apple Silicon Macs: /opt/homebrew

This difference, among others, requires different compilation instructions.

Intel Mac – Intel location of Homebrew

For older Intel Macs, this tutorial’s commands may work if you

change    ‘/opt/homebrew/opt‘      to        ‘/usr/local/homebrew/opt

in the build/compile commands given later on. It may likely require additional modifications.

However, I will provide a separate page (currently being developed for 3.8) for those commands on Intel Macs.

The techniques for installing v 3.7 did not work for v 3.8 and I’ve modified many of the commands and installation instructions here for v3.8.

Overview of the wgrib2 3.8 Installation and Compilation Steps for MacOS

  1. Change the default Terminal shell to bash shell
  2. Give Terminal Full Disk Access in Privacy Settings
  3. Check the hidden .bash_profile file or create if it is missing
  4. Download and Install Apple Command Line Tools
  5. Download Homebrew package installer needed to install required library “dependencies”.
  6. Create Homebrew‘s recommended links and $PATH changes in .bash_profile
  7. Give Homebrew Full Disk Permissions
  8. Using Homebrew, install various library dependencies – gcc, gfortran, cmake and others. Confirm proper directory structure and PATHs using ‘brew doctor‘ command.
  9. Download NCEPLIBS-wgrib2, NCEPLIBS-ip and NCEPLIBS-g2c from the GitHub
  10. Edit the CMAKEFILE.txt in two of the three above library directories. For v 3.8, I now have the “make” command do much of this modification.
  11. Copy and paste the edited copies of NCEPLIBS-wgrib2, NCEPLIBS-ip and NCEPLIBS-g2c into usr/opt directory.
  12. Run the CMAKE commands provided for each of those directories using Terminal commands provided below to build and compile. The NCEPLIBS-wgrib2 is installed LAST.
  13. Create a symlink of the installed wgrib2, adding it to so that it can easily be called using Terminal.
  14. Create a $PATH in .bash_profile so that wgrib2 can ‘find’ the other dependent library directories.

Existing Users: If you’re already using wgrib2 v 3.7 or v3.1.3 and earlier and you wish to upgrade to v3.8, you must remove the existing grib2 folder and your existing symlink in your ~/bin directory before proceeding to install wgrib2 3.8.

It is also recommended that you run “brew update” command followed by “brew upgrade” and/or “brew reinstall” on the required specified dependent libraries. It wouldn’t hurt to reinstall Command Line Tools. (If you’re already using wgrib2, you know what these suggestions mean.)

Let’s Get Started

Make sure you are have administrator privileges on your Mac. Your probably do if you’re the only user of your machine.

1. Change Default Shell to bash

The Terminal program (Applications>>Utilities>>Terminal) on Sequoia uses something called zsh as the default shell command language.

For this installation, we are going to switch back to the older shell called bash.

Use your Terminal application to switch its shell default.

Open Terminal. Copy, then paste this command at the Terminal prompt:

chsh -s /bin/bash

Then Press return. It will request your password. Press return again.

You MUST Quit Terminal to have the change activated.

If you re-open Terminal, your bash command prompts should now begin with $ (bash) instead of % (zsh)

2. Change Terminal Disk Access Permissions

In Sequoia and Sonoma, Terminal needs to be given permission to access files. (According to Apple, Apple installed programs don’t need this, but that’s not been my experience.)

Go to System Settings>> Privacy & Security

Select Full Disk Access>

Click on the +, navigate to Applications>Utilities and add Terminal to the list. (Your Password will be needed)—

Use the + to add Terminal for Full Disk Access permissions.

3. Check or Create Terminal’s .bash_profile

When you launch the Terminal program, there’s a hidden file that tells it where certain other code and libraries are located on you Mac. The “paths” (referred to as the variable $PATH) to these code libraries are contained in this hidden file called the .bash_profile. The period(.) at the beginning of the name makes this file hidden in the Finder.

Since we’ll be installing wgrib2 with Terminal and Homebrew, the Terminal program will need to “know” the path where Homebrew placed all of its libraries and where the wgrib2 dependencies are located. The .bash_profile has this information.

To see if you have a .bash_profile, open Terminal and enter the following commands, then press Return—

cd ~/
ls -a

You should see Terminal show all the files and directories in the main user directory. Many are normally hidden to the user.
Look for the hidden file .bash_profile

If you see a .bash_profile, you’re good to go to the next step

If you don’t see .bash_profile, you need to create one.
With the Terminal window still open, copy and paste the following commands in Terminal. Press Return after.

cd ~/
touch .bash_profile

That should do it!

3a. Allow Finder Path Bar to be Visible

While we’re in the Finder, with any Finder window open, Select Finder>>View>> Show Path Bar

This comes in handy. It will show you the directory path you’re in at the bottom of the Finder windows. Clicking on the small icons can move you up a level or two. This is especially useful when navigating hidden folders as we will be doing later.

Finder window with Path Bar visible at bottom. Having this visible makes it easier to know where you are, especially when installing in normally hidden directories. You can click on higher level folder and it will take you right there!

One more thing. To make life easier, while we’re changing Finder Settings, make sure you selected “Show all filename extensions” in Finder Advanced Settings—

4. Download and Install Apple Command Line Tools

We need to install Apple Command Line Tools.

Launch Terminal (in your Applications/Utilities Folder )

Copy and paste the following command, then press Return—

xcode-select --install

Another dialog box will pop up. Click Install. Press OK to the license agreement.

It will take a few minutes to install Command Line Tools A dialog box will appear when the install is completed.

When completed, copy and paste the following command in Terminal to check to see if it’s been installed—

xcode-select -p

You should see a confirmation showing where it’s installed

/Library/Developer/CommandLineTools

I strongly recommend that you Quit Terminal after each major step and then restart the Terminal program. It avoids errors, specifically the issue of being accidentally in the wrong directory.

Additionally, if any command doesn’t seem to work, make sure there’s no hidden blank “space” following the pasted command.

5. Download and Install Homebrew

Homebrew is a “package installer” and is used to download and install certain dependency libraries of code, used by many utilities including wgrib2. We’ll be using Homebrew to install the dependent compiler packages called gcc (includes gfortran) and cmake, along with some others.

To install Homebrew, go to https://brew.sh/

While Homebrew is often installed with a simple Terminal command copied from the main page, I recommend you download the latest version from Github here and use the installer package to install Homebrew . Run the latest version.

Select the GitHub site to get the package installer

Homebrew’s github page—

Download the latest version

Download the Homebrew installer package to your Downloads folder.

When the download is completed, open your Downloads folder, double-click to launch it. On launch, you’ll receive this message:

This package will install to the following directories:
/opt/homebrew on a clean new Apple Silicon machine.

On Apple Silicon Machines migrated from a previous Intel computer backup, it might still be using the /usr/local/ directory. In this case, Homebrew will be installed at /usr/local/Homebrew on Intel.

When the Homebrew installer is finished, pay attention to the message displayed—

To add Homebrew to your $PATH, add this path code to your shell profile .bash_profile”

Clean Install on Apple Silicon M1 -M4 and greater:
eval “$(/opt/homebrew/bin/brew shellenv)”

Macs with systems migrated from a previous Intel Mac.
eval “$(/usr/local/bin/brew shellenv)”

The next section explains how to add Homebrew to your $PATH variable.

6. Add Homebrew $PATH to your .bash_profile

Here’s how we add Homebrew to your $PATH variable.

Open Terminal,, then copy the entire command below, then press Return—

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
source ~/.bash_profile

(For older Intel Macs ONLY, use this command below—)

echo 'eval "$(/usr/local/bin/brew shellenv)")"' >> ~/.bash_profile
source ~/.bash_profile

7. Give Homebrew Full Disk Access

As mentioned, Sequoia (and Sonoma) are more stringent about disk access permissions for security reasons. We need to give Homebrew permissions to folders. (It’s not clear whether this needs to be done, but I’ve had installation issues when permissions weren’t granted to Homebrew.) Let’s rectify this restriction.

As we did in Step 2 above, (Adding Full Disk Access to Terminal), we need to give Homebrew Full Disk Access permissions.

Apple doesn’t make this easy, because the Homebrew executable (called “brew“) is normally hidden, but here’s the solution—

Go to System Settings>> Privacy & Security

Select Full Disk Access

Full Disk Access to reveals current applications with full access—

If you’re doing a true clean install, from this instructions, you will probably only see Terminal in this list.

Press the +. You’ll be requested to enter your password.

Press + to add Homebrew brew executable

When the open dialog presents, press these three keys together

COMMAND-SHIFT-G

For Apple Silicon Macs—

enter /opt/homebrew/bin and press return

/opt/homebrew/bin

This will reveal the normally hidden Homebrew executable called “brew” in the bin directory (/opt/homebrew/bin) —

Select brew and click Open

Select brew in the open dialog and click Open

The brew executable will be added to this list.

You’ve given Homebrew the necessary permissions to run in Sequoia and Sonoma.

8. Using Homebrew, install library dependencies

Now that we’ve given Homebrew permissions to access directories we’re going to use Homebrew to install specific code libraries that wgrib2 and its associated libraries compilations will need.

We’ll be installing

gcc (gfortan, also needed, is automatically installed with gcc)

cmake

zlib libpng

openblas

• lapack

pkg-config

We will be installing libraries that read JPEG 2000 and Type 40 compression, the most common for NOAA, ECMWF, Canadian and German DWD weather grib2 files. We will not be enabling .PNG support.

Installing these libraries of code with Homebrew is pretty simple and the commands are all similar. Let’s start with gcc

Install gcc

First Quit Terminal , then Re-Open Terminal

Copy and paste the command below in Terminal and press return

brew install gcc

gcc should then be installed. (Give it time. Wait until you see the command prompt again to know its completed. )

Check to see if/where it’s installed,  copy and paste the following command in Terminal and press return—

 which gcc

and terminal should show this-

/opt/homebrew/bin/gcc on Apple Silicon

Installation of gcc includes automatic installation of gfortran.

Repeat the same sequence with the remaining Homebrew library code installs—

Install cmake
brew install cmake

Install libpng

brew install zlib libpng
Install openblas
brew install openblas
Install lapack
brew install lapack
Install jasper
brew install jasper
Install libaec
brew install libaec
Install pkg-config
brew install pkg-config

You can check that each are installed with the same “which” command. When all six libraries have been installed, you can Quit Terminal.

Quit Terminal for now.

9. Download NCEPLIBS-wgrib2, NCEPLIBS-ip and NCEPLIBS-g2c from GitHub

The three libraries needed to install wgrib2 are found here—

NCEPLIBS-wgrib2 https://github.com/NOAA-EMC/wgrib2
NCEPLIBS-ip https://github.com/NOAA-EMC/NCEPLIBS-ip
NCEPLIBS-g2c https://github.com/NOAA-EMC/NCEPLIBS-g2c

Instead of manually downloading from each web page, GitHub provides an easier way of downloading these three packages.

Using Terminal, copy, paste, and press RETURN for each of the following 3 commands:

cd ~/Downloads
git clone https://github.com/NOAA-EMC/NCEPLIBS-wgrib2.git

Wait for the download to finish, then copy and paste this command:

git clone https://github.com/NOAA-EMC/NCEPLIBS-ip.git

Wait for the download to finish, then copy and paste this command:

git clone https://github.com/NOAA-EMC/NCEPLIBS-g2c.git

These three NCEPLIBS library folders should now be in your Downloads Folder.

10. Edit the Compilation file instructions: CMakeLists.txt

We’re still working in your Downloads Folder with each of the three folders you have just downloaded— NCEPLIBS-wgrib2 NCEPLIBS-ip NCEPLIBS-g2c

Inside each of those three folders is a text file called CMakeLists.txt

Using any text editor, we will open and edit the ‘ CMakeLists.txt‘ files in two of the three folders.

We’re going to change the order that we’re looking at these three folders— First NCEPLIBS-ip, then NCEPLIBS-g2c and finally NCEPLIBS-wgrib2

10a. No changes are needed in the NCEPLIBS-ip CMakeLists.txt file.

10b. Open the NCEPLIBS-g2c folder. You’ll see the CMakeLists.txt—

NCEPLIBS-g2c folder- Open the CMakeLists.txt in TextEdit or BBedit

Make any needed edits of this NCEPLIBS-g2c/CMakeLists.txt so that the options match what’s below (some of these have become defaults in v 3.7 and may not require any change)

These are the settings that work for me —

option(ENABLE_DOCS “Enable generation of doxygen-based documentation.” OFF)
option(USE_PNG “Use PNG library” ON)
option(USE_Jasper “Use Jasper library” ON)
option(USE_OpenJPEG “Use OpenJPEG library” OFF)
option(USE_AEC “Use LibAEC library” ON)
option(BUILD_SHARED_LIBS “Build shared libraries” ON)
option(BUILD_STATIC_LIBS “Build static libraries” ON)
option(FTP_TEST_FILES “Fetch and test with files on FTP site.” OFF)
option(FTP_LARGE_TEST_FILES “Fetch and test with very large files on FTP site.” OFF)
option(FTP_EXTRA_TEST_FILES “Test with more large files fetched via FTP.” OFF)
option(LOGGING “Turn on internal logging messages. Only useful to g2c developers.” OFF)
option(PTHREADS “Turn on thread-safty with pthreads.” OFF)
option(UTILS “Build and install some utility programs.” ON)
option(BUILD_G2C “Build the g2c file-based API.” ON)

(any other options as defaults can be left as is.)

–>After making any changes, SAVE and close this .txt file.

10c. Next, let’s go to the NCEPLIBS-wgrib2 folder

Now go to the NCEPLIBS-wgrib2 folder and open the folder and make these edits of its CMakeLists.txt file.

The highlighted changes are what I recommend

option(ENABLE_DOCS “Enable generation of doxygen-based documentation.” OFF)
option(USE_NETCDF “Use NetCDF” off)
option(USE_REGEX “Use Regex?” on)
option(USE_TIGGE “Use tigge?” on)
option(USE_MYSQL “Use MySQL?” off)
option(USE_IPOLATES “Use Ipolates” on)
option(USE_UDF “Use UDF?” off)
option(USE_OPENMP “Use OpenMP?” on)
option(USE_PROJ4 “Use Proj4?” off)
option(USE_WMO_VALIDATION “Use WMO Validation?” off)
option(DISABLE_TIMEZONE “Disable posix Timezone?” off)
option(DISABLE_ALARM “Disable Alarm?” off)
set(USE_NAMES “NCEP”)
option(USE_G2CLIB_HIGH “Use g2c high-level decoder (-g2clib 2)?” on)
option(USE_G2CLIB_LOW “Use g2c low-level decoders (png,jpeg2000)?” on)
option(BUILD_EXTRA “Build user-contributed code” OFF)
option(FTP_TEST_FILES “Fetch and test with files on FTP site.” OFF)
option(FTP_LARGE_TEST_FILES “Fetch and test with very large files on FTP site.” OFF)
option(FTP_EXTRA_TEST_FILES “Fetch even more large files from FTP and test them.” OFF)

option(MAKE_FTN_API “add ftn api?” off)
option(DISABLE_STAT “disable posix feature” off)
set(BUILD_COMMENTS “stock build”)

option(BUILD_LIB “Build wgrib2 library?” on)

–>After making any changes, SAVE and close this .txt file.

It should be noted that most of the changes to the above CMakeLists.txt files are probably superfluous, because I now have explicitly specified what’s needed in the install commands that you’ll see below.

11. Copy and paste all three of your modified NCEPLIBS-wgrib2, NCEPLIBS-ip, NCEPLIBS-g2c library folders into the /opt Directory

Sill in the Downloads Folder of the Finder, select all three of the newly modified NCEPLIBS-wgrib2 NCEPLIBS-ip NCEPLIBS-g2c folders, select the Copy command (select all 3 while by clicking on each and holding the Command Key) , from the Edit Menu, or use the Command-c shortcut. You’re copying all three folders and their contents at once.

Using the Go menu command from the Finder, select Go to Folder… or use the keys COMMAND-SHIFT-G

Enter

/opt

(For older Intel Macs ONLY, enter)

/usr/local

(If you’re installing on an older Intel Mac you should jump to the commands on this page (to be updated) for Intel Macs going forward.)

When the /opt directory opens, select Paste (Command -v) from the Finder Edit menu and all three folders you copied from Downloads folder should now appear in the /opt directory

(for Intel Macs only, they are pasted in the /usr/local directory)

opt folder (usually hidden)

12. Run the CMAKE Build Install and Compile commands

For older Intel Macs, I’ve created a cheat sheet for the commands for those machines here (to be updated from 3.7)

a. Start with NCEPLIB-ip. Build and compile NCEPLIB-ip

Open Terminal

Copy ONE command at a time below and PASTE into Terminal then press RETURN. Let it run before copying and pasting the next command. The first ‘sudo’ command will request your password. Wait for each command to complete—

cd /opt/NCEPLIBS-ip
sudo mkdir build && cd build
sudo cmake .. -DCMAKE_INSTALL_PREFIX=/opt/homebrew/opt/NCEPLIBS-ip
-DBUILD_SHARED_LIBS=ON \
-DBLAS_LIBRARIES=/opt/homebrew/opt/openblas/lib/libblas.dylib \
-DLAPACK_LIBRARIES=/opt/homebrew/opt/lapack/lib/liblapack.dylib
sudo make -j$(sysctl -n hw.logicalcpu)
sudo make install

There should be no errors at the end.

b. Next, build and compile NCEPLIB-g2c

Copy each command block below one at a time and PASTE into Terminal then press RETURN. The first ‘sudo’ command may request your password, but it may not if you’ve already entered it for the previous library build. Wait for each command to complete before proceeding with the next command line.

cd /opt/NCEPLIBS-g2c
sudo mkdir build && cd build
export JASPER_INCLUDE_DIR=/opt/homebrew/opt/include/jasper
export JASPER_LIBRARIES=/opt/homebrew/opt/lib/libjasper.dylib
export JPEG_INCLUDE_DIR=/opt/homebrew/opt/include
export JPEG_LIBRARY=/opt/homebrew/opt/lib/libjpeg.dylib
sudo cmake .. -DCMAKE_INSTALL_PREFIX=/opt/homebrew/opt/NCEPLIBS-g2c \
-DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 \
-DCMAKE_OSX_ARCHITECTURES=arm64
sudo make -j$(sysctl -n hw.logicalcpu)
sudo make install

There should be no errors at the end.

c. Finally, build and compile NCEPLIB-wgrib2

Copy each command block below one at a time and PASTE into Terminal then press RETURN. The first ‘sudo’ command may request your password. Wait for each command to complete.

cd /opt/NCEPLIBS-wgrib2
sudo chown -R "$(id -un)":admin /opt/NCEPLIBS-wgrib2
rm -rf build
mkdir build && cd build
GCC_VER=15  #assumes you're using gcc-15
LIBGOMP_DIR="/opt/homebrew/lib/gcc/${GCC_VER}"
LIBAEC_PREFIX="$(brew --prefix libaec)"
if [ ! -f "${LIBGOMP_DIR}/libgomp.dylib" ] && [ -f "${LIBGOMP_DIR}/libgomp.1.dylib" ]; then
ln -sf "${LIBGOMP_DIR}/libgomp.1.dylib" "${LIBGOMP_DIR}/libgomp.dylib"
fi
export CPPFLAGS="-I/opt/homebrew/opt/zlib/include -I/opt/homebrew/opt/openblas/include -I/opt/homebrew/opt/lapack/include -I${LIBAEC_PREFIX}/include"
export LDFLAGS="-L/opt/homebrew/opt/zlib/lib -L/opt/homebrew/opt/openblas/lib -L/opt/homebrew/opt/lapack/lib -L${LIBAEC_PREFIX}/lib"
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig:/opt/homebrew/lib/pkgconfig:/opt/homebrew/share/pkgconfig:${PKG_CONFIG_PATH-}"
cmake .. \
-DCMAKE_INSTALL_PREFIX=/opt/homebrew/opt/NCEPLIBS-wgrib2 \
-DCMAKE_PREFIX_PATH="/opt/homebrew/opt/NCEPLIBS-ip;/opt/homebrew/opt/NCEPLIBS-g2c;/opt/homebrew" \
-DCMAKE_C_COMPILER=/opt/homebrew/bin/gcc-15 \
-DCMAKE_Fortran_COMPILER=/opt/homebrew/bin/gfortran-15 \
-DUSE_OPENMP=ON \
-DUSE_G2CLIB_HIGH=ON \
-DUSE_G2CLIB_LOW=ON \
-DCMAKE_C_FLAGS="-I${LIBAEC_PREFIX}/include -I/opt/homebrew/include -fopenmp" \
-DCMAKE_SHARED_LINKER_FLAGS="-L${LIBGOMP_DIR} -Wl,-rpath,${LIBGOMP_DIR} -lgomp -fopenmp" \
-DCMAKE_EXE_LINKER_FLAGS="-L${LIBGOMP_DIR} -Wl,-rpath,${LIBGOMP_DIR} -lgomp -fopenmp"
sudo make -j$(sysctl -n hw.logicalcpu)
sudo make install

There should be no errors at the end.

13. Create a $PATH addition and Symlink

At this point, Quit Terminal. Then Restart Terminal again.

First we’ll create a symlink in /opt/homewbrew/bin so Terminal can find and invoke wgrib2—

Enter this in Terminal and press return—

ln -s /opt/homebrew/opt/NCEPLIBS-wgrib2/bin/wgrib2 /opt/homebrew/bin

So that wgrib2 can find dependent libraries, we’re going to use a command to edit your .bash_profile $PATH variable.

Using Terminal Enter these as single separate commands—

export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-wgrib2/lib:$DYLD_LIBRARY_PATH"
echo 'export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-wgrib2/lib:$DYLD_LIBRARY_PATH"' >> ~/.bash_profile
source ~/.bash_profile
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-ip/build/install/include_4:$DYLD_LIBRARY_PATH"
echo 'export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-ip/build/install/include_4:$DYLD_LIBRARY_PATH"' >> ~/.bash_profile
source ~/.bash_profile
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-g2c/lib:$DYLD_LIBRARY_PATH"
echo 'export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-g2c/lib:$DYLD_LIBRARY_PATH"' >> ~/.bash_profile
source ~/.bash_profile
export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-ip/lib:$DYLD_LIBRARY_PATH"
echo 'export DYLD_LIBRARY_PATH="/opt/homebrew/opt/NCEPLIBS-ip/lib:$DYLD_LIBRARY_PATH"' >> ~/.bash_profile
source ~/.bash_profile

14. Test if wgrib2 has been installed

Now, let’s check if wgrib2 has been installed with the symlink working—

Quit Terminal. Then Restart Terminal again.

In Terminal, enter the following command and press return—

which wgrib2

You should see the response

/opt/homebrew/bin/wgrib2

(If you don’t see this response, you’ll need to create a symlink to the wgrib2 executable.)

To see what wgrib2 can do, just enter this command in Terminal and press return:

wgrib2

You should see all the commands wgrib2 can accept – scroll in the Terminal window.

(If you don’t see the command list, wgrib2 is either not installed or the symlink created in .bash_profile is not correct.)

To see wgrib2 in action, use the terminal command on any .grib2 file you have to see its message contents—

wgrib2 -s /pathto/mygrib2file.grib2

Use the tips found here to use wgrib2— https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/tricks.cheap

see the "tricks" links at

https://www.ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/


Need Help with an Installation?

Use this Feedback form to email me.

Include your email address and the following information:

• Are you using Intel or Apple Silicon (M1, etc) ? These instructions are for Apple Silicon.

• What Mac System Version are you using? (Sonoma Sequoia Other)

• Have you previously installed conda or miniconda?

• Have you previously installed Homebrew?

• Is this a new, clean install machine or were your computer files migrated from a previous Intel Mac in the past?

• Have you previously installed Homebrew?

• Which directory is Homebrew installed in ?     /usr/local   or   /opt

Here’s a helpful article here about HomeBrew and Apple Silicon.
Here’s a helpful article about removing Homebrew to start clean.


#wgrib2 #install _wgrib2 _on_MacOS


Weather… and Other Things 'Up in the Air'