中文用戶請參考此頁面

This tutorial applies to macOS 13 (Ventura) and later versions. You may not need to follow every step below, depending on your Mac’s configuration. All commands should be executed in a terminal, such as Terminal.app.

Install Xcode Command Line Tools Link to heading

xcode-select --install

Install and configure GCC Link to heading

GCC is a collection of development tools, including those required by the NONMEM installation program. Although multiple versions of GCC are available, NONMEM appears to be compatible only with GCC version 11 or earlier.

To install GCC@11, we first need to install Homebrew, a package management tool for macOS and Linux. Run the following command in the terminal:

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

Once Homebrew is installed, use the following command to install GCC@11:

brew install gcc@11

GCC@11 installs gcc-11 and gfortran-11 commands, which are necessary for compiling the NONMEM source files. However, NONMEM only recognizes the gcc and gfortran commands. To resolve this issue, you can use either of the following methods.

We can create symbolic links to make gcc and gfortran point to gcc-11 and gcc-fortran using the following commands:

sudo ln -s $(which gcc-11) /usr/local/bin/gcc
sudo ln -s $(which gfortran-11) /usr/local/bin/gfortran

Use the following commands to verify the symbolic links:

which gcc
which gfortran

You should see the following message:

/usr/local/bin/gcc
/usr/local/bin/gfortran

Please note that this method may not work in all cases.

We can set gcc and gfortran as aliases for gcc-11 and gfortran-11 using the following commands:

echo 'alias gcc="gcc-11"' >> ~/.zprofile
echo 'alias gfortran="gfortran-11"' >> ~/.zprofile

Reload the shell configuration for the aliases to take effect:

source ~/.zprofile

Run the following commands to verify the configuration:

which gcc
which gfortran

You should see the following message:

gcc: aliased to gcc-11
gfortran: aliased to gfortran-11

Disable macOS Gatekeeper Link to heading

macOS may flag NONMEM as an application from an unverified developer, triggering Gatekeeper security that blocks the installation. To proceed, we can (temporarily) disable Gatekeeper:

sudo spctl --global-disable

Install NONMEM Link to heading

Assuming the NONMEM source file folder is located at ~/Downloads/NM751CD, and the target installation location is /opt/nm751.

We first navigate to the NONMEM source directory:

cd ~/Downloads/NM751CD 

Then run the command below to initiate the NONMEM installation:

sudo /bin/bash ./SETUP75 ~/Downloads/NM751CD /opt/nm751 gfortran

You will be prompted to enter your password, after which you can follow the installation wizard to complete the process.

Finally, after the installation is complete, remember to re-enable Gatekeeper:

sudo spctl --global-enable

*As of Dec 2024, the following configurations have been successfully verified.

Device macOS GCC NONMEM
Macbook Pro (M1, 2020) Big Sur 10.2 x86 7.5.1
Macbook Pro (M1, 2020) Monterey 11.3 ARM 7.5.1
Macbook Pro (M1, 2020) Ventura 11.5 ARM 7.5.1
Macbook Pro (M3 Pro, 2023) Sonoma 11.3 x86 7.5.1
Macbook Pro (M3 Pro, 2023) Sequoia 11.5 ARM 7.5.1
Macbook Pro (M4 Pro, 2024) Sequoia 11.5 ARM 7.6.0