Home > front end >  How do I compile MODFLOW6 on Mac?
How do I compile MODFLOW6 on Mac?

Time:11-17

I'm familiar with cmake, however I don't see a cmake file in the MODFLOW6 code. I thought I had brew installed, but my computer can't seem to find it. Any help getting MODFLOW6 compiled would be great!

CodePudding user response:

Go to https://brew.sh/ and get the homebrew install command from there:

From the command-line run:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Add it to the path with:

sudo echo "export PATH=\"/opt/homebrew/bin/:$PATH\"" >> ~/.zshrc

Load the homebrew path into your activate terminal

source ~/.zshrc

Install the meson build system and gfortran

brew install meson
brew install gfortran
brew install git

Acquire the code:

git clone https://github.com/MODFLOW-USGS/modflow6.git

Enter the directory:

cd modflow6

Make a build directory:

mkdir build
cd build

Build the makefiles:

meson ..

Compile the code:

ninja

The compiled code is now at:

modflow6/build/utils/mf5to6

You can even add this to your path with:

sudo echo 'export PATH="$HOME/modflow6/build/utils/mf5to6:$PATH"' >> ~/.zshrc
source ~/.zshrc

if you want to be able to run mf5to6 from anywhere.

Alternatively, you can run it from its location using:

./modflow6/build/utils/mf5to6
  • Related