Does macOS have clang
and gcc
at the same time, but they are actually the same thing?
When I ran the following command:
gcc -v
I discovered that “gcc” is actually “clang”, as shown in the screenshot here:
enter image description here
I then found two files on my MacBook: /usr/bin/gcc
and /usr/bin/clang
. They appear to be separate files rather than symbolic links, but I suspect they have the same content, as shown in the screenshot here:
enter image description here
It seems like the file
/usr/bin/clang
was copied and then renamed togcc
.
What’s going on here?
2
Actually, these two files (and others as well) are hard links. You can see this with ls -li
which shows the inode number:
--> ls -li /usr/bin/cc /usr/bin/gcc /usr/bin/clang
1152921500312525479 -rwxr-xr-x 77 root wheel 119008 Aug 4 22:31 /usr/bin/cc
1152921500312525479 -rwxr-xr-x 77 root wheel 119008 Aug 4 22:31 /usr/bin/clang
1152921500312525479 -rwxr-xr-x 77 root wheel 119008 Aug 4 22:31 /usr/bin/gcc
On my machine there are a total of 77 links to that executable — not sure where all the others are.
1