Skip to content

Mac Installation Guidelines (Apple Silicon) change proposal: NetCDF path should use /opt/homebrew instead of /usr/local/Cellar #16

@datuadiatma

Description

@datuadiatma

Description

The current installation guide (muffin3.install.MacOS.pdf) for M1/M2 Macs contains instructions that can lead to compilation errors when running make testbiogem.

Problem

Following the current instructions in step 7, users are directed to set:

NETCDF_DIR=/usr/local/Cellar/netcdf/4.9.2_1

Or whatever the output of the brew info.

However, on M1/M2 Macs with Homebrew, this causes the following error:

Fatal Error: Cannot open module file 'netcdf.mod' for reading at (1): No such file or directory

This occurs because:

  1. The path needs to accommodate both netcdf and netcdf-fortran packages
  2. Pointing to a specific version in /Cellar/ breaks when packages are updated (may be, this is just a guess)

Solution

In user.mak (step 7), M1/M2 Mac users should set:

NETCDF_DIR=/opt/homebrew

This parent directory contains symlinks to both required libraries and remains stable across package updates.

Additional Issue: Whitespace in MACHINE Setting

Users should be careful when editing the MACHINE=OSX_M line - any trailing spaces will cause the conditional compilation flags to fail, resulting in:

gfortran: error: unrecognized command-line option '-msse'

Suggested Documentation Updates

The installation guide should be updated to:

  1. Recommend /opt/homebrew for M1/M2 Macs (instead of the version-specific Cellar path)
  2. Add a troubleshooting note warning about whitespace in the MACHINE variable
  3. Clarify that Intel Macs use /usr/local while Apple Silicon uses /opt/homebrew

Environment

  • macOS with M1 processor
  • Homebrew package manager
  • netcdf 4.9.3_1
  • netcdf-fortran 4.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions