examining the macOS gcc binary
Web page · https://zoey-on-github.github.io/blog/macgcc.html
First seen by Oriel on .
AI summary
The macOS `gcc` command is a wrapper chain: the `/usr/bin` binary invokes `xcrun`, which selects and runs `clang` or `clang++` from the active developer tools.
- The initial `gcc` binary uses `libxcselect.dylib` logic to map tool names such as `c++` and `llvm-gcc` to compiler names before invoking `xcrun`.
- `xcrun --find gcc` locates the wrapper at `/Library/Developer/CommandLineTools/usr/bin/gcc`.
- In that directory, `cc` and `clang++` are aliases to `clang`, while `g++` points to a separate `gcc` binary; some tool names are handled directly by the initial binary.
- The separate `gcc` binary executes `/usr/bin/xcrun`, passing `clang++` when invoked with a name ending in `++`, and `clang` otherwise.
- The author suggests SIP protection and flexibility to change the developer-tools directory may explain this indirection, but presents these as guesses.
#macos #clang #xcrun #command line tools
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 61, latest observation ; +60 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 22, latest observation ; +22 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | hplfis | https://zoey-on-github.github.io/blog/macgcc.html Read discussion |