how to find gcc version on mac

2020-05-19 02:27发布

I am using OS 10.9 on mac machine. I want to know the version of gcc I am using. So I tried gcc --version on terminal and it results :

$ gcc --version
Configured with: --prefix=/Applications/Xcode5-DP.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode5-DP.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.1.58) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

Here in output, there is no detail related to gcc but clang is there. I am confused whether gcc command executes clang or gcc(gnu).

标签: c macos gcc
4条回答
家丑人穷心不美
2楼-- · 2020-05-19 02:34
gcc -dumpversion | cut -f1 -f2 -f3 -d.
查看更多
戒情不戒烟
3楼-- · 2020-05-19 02:43

The tools supplied by Apple have been switched from GCC to Clang. The gcc command is linked to clang as a convenience. In OS X 10.9, you do not have GCC on your system unless you have installed it independently of Apple packages.

查看更多
Evening l夕情丶
4楼-- · 2020-05-19 02:50
gcc -dumpversion | cut -f1 -d.

-dumpversion Print the compiler version (for example, 3.0) — and don't do anything else.

The same works for following compilers/aliases:

cc -dumpversion
g++ -dumpversion
clang -dumpversion
tcc -dumpversion
查看更多
仙女界的扛把子
5楼-- · 2020-05-19 02:59

You seem to not actually have gcc on your path. As of recent versions of Xcode, it installs a "gcc" that is instead a link to Clang.

查看更多
登录 后发表回答