Error compiling Fortran program on Apple Silicon with gfortran

I've followed the instructions posted on this closed thread: Fortan Compiler for Apple Silicon (M1, M2… - Apple Community about installing/running gfortran on Apple Silicon. However, I'm getting this error when attempting to compile a simple program:


clang: warning: overriding deployment version from '16.0' to '26.0' [-Woverriding-deployment-version]

ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64

collect2: error: ld returned 1 exit status


Any thoughts as to what could be the issue?


[Re-Titled by Moderator]

Original Title: Gfortran on Apple Silicon

iMac (M3, 2023)

Posted on Oct 20, 2025 7:22 AM

Reply
Question marked as Top-ranking reply

Posted on Oct 20, 2025 8:04 AM

The build looks stuffed up, particularly around the selected linking. That usually means the gfortran pieces installed don’t match the Xcode command-line tools installed (or the command-line tools version selected).


Per an Apple rep: To start, I recommend that your read An Apple Library Primer, which explains a lot of the backstory.


Errors like this indicate that you have a mismatch between the linker and the SDK. The SDK contains stub libraries (.tbd files) that the linker doesn’t understand. That should never happen with Apple tools because our tools and SDKs are rev-locked. That is, the Xcode 14.1 command-line tools include, and only support, the macOS 13.0 SDK. Something in your setup is trying to ‘cross the streams’ but it’s hard to say what given the number of third-party bits you have in play.


If your Fortran code is not tied to gfortran features or extensions, see if flang works better for your case.

brew install flang


As for the other reply, I would generally not choose to blow away the command line tools with a sudo rm command.

3 replies
Question marked as Top-ranking reply

Oct 20, 2025 8:04 AM in response to DSC31

The build looks stuffed up, particularly around the selected linking. That usually means the gfortran pieces installed don’t match the Xcode command-line tools installed (or the command-line tools version selected).


Per an Apple rep: To start, I recommend that your read An Apple Library Primer, which explains a lot of the backstory.


Errors like this indicate that you have a mismatch between the linker and the SDK. The SDK contains stub libraries (.tbd files) that the linker doesn’t understand. That should never happen with Apple tools because our tools and SDKs are rev-locked. That is, the Xcode 14.1 command-line tools include, and only support, the macOS 13.0 SDK. Something in your setup is trying to ‘cross the streams’ but it’s hard to say what given the number of third-party bits you have in play.


If your Fortran code is not tied to gfortran features or extensions, see if flang works better for your case.

brew install flang


As for the other reply, I would generally not choose to blow away the command line tools with a sudo rm command.

Oct 20, 2025 7:38 AM in response to DSC31

DSC31 wrote:

I've followed the instructions posted on this closed thread: Fortan Compiler for Apple Silicon (M1, M2… - Apple Community about installing/running gfortran on Apple Silicon. However, I'm getting this error when attempting to compile a simple program:

clang: warning: overriding deployment version from '16.0' to '26.0' [-Woverriding-deployment-version]
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
collect2: error: ld returned 1 exit status

Any thoughts as to what could be the issue?

[Re-Titled by Moderator]
Original Title: Gfortran on Apple Silicon


See if this there is anything here—


sudo rm -rf /Library/Developer/CommandLineTools



ref: https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file

Oct 20, 2025 8:32 AM in response to DSC31

DSC31 wrote:

Any thoughts as to what could be the issue?

That thread is 2 years old. And even worse, it recommends using Homebrew. Homebrew is well-known to stop working after major OS upgrades. The error you're getting is talking about Intel.


Unfortunately, that's all pretty standard for homebrew. It's pushed on people as a quick-and-easy way to get open-source projects running on a Mac. But then, when it fails, as it does 100% of the time, people have no idea how to fix it. So they come here. But we didn't develop homebrew. I would certainly never recommend it to anyone.


A quick Google search suggests that this project would be a much better idea: https://github.com/fxcoudert/gfortran-for-macOS


Oh look, it's 80% Perl. It doesn't surprise me that a project like Homebrew could be replaced by a Perl script.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Error compiling Fortran program on Apple Silicon with gfortran

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.