I am a new Mac user and need to install GNU compilers (C and C++) and CMake for the code I am using.

I installed gcc and its binary utilities and CMake via Homebrew with the correct PATH to the executables (/usr/local/bin). However, compiling my code shows error messages regarding a missing linker.

It seems like installing gcc and binutils via Homebrew does not include ld linker. Does anyone know how to manually install ld (via Homebrew preferrably)?


As explained in this Homebrew Github issue:

GNU binutils's ld does not support Darwin (macOS), and is thus not built [in the Homebrew package]

Use the ld version provided with macOS located at /usr/bin/ld.

  • From a comment here, the easiest way for me to restore the system ld was simply to run. brew unlink binutils. – jaybrau Aug 9 '19 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .