GFortran error: ld: library not found for -lSystem when trying to compile

On macOS Big Sur v11.1:

Relevant SO post: https://apple.stackexchange.com/questions/408999/gfortran-compiler-error-on-mac-os-big-sur

The fix is to add the stdlib to your $LIBRARY_PATH. For some reason or another it isn’t in your standard $PATH anymore on 11.1.

export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

(or add it to login file and restart terminal).

Leave a Comment