Macos – Install GCC on Mac OS high sierra

cgccmacos

I've already visited the following answer but my question is different.

Install GNU GCC on mac

Mac OS ships with Clang and somehow /usr/bin/gcc is linked to Clang tool I assume because of this line.

gcc

clang: error: no input files

Any idea on how can I install https://gcc.gnu.org/ standalone on my system?

gcc --version

Configured with: –prefix=/Applications/Xcode.app/Contents/Developer/usr –with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/c++/4.2.1

Apple LLVM version 9.0.0 (clang-900.0.38)

Target: x86_64-apple-darwin17.2.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Best Answer

Any idea on how can I install https://gcc.gnu.org/ standalone on my system?

Generally speaking: Don't. That isn't a standard configuration; Clang is the recommended compiler for current macOS systems.

If you have a very good reason, you can use Homebrew to install GCC (brew install gcc). Keep in mind that it cannot be used to build native macOS applications.

Related Topic