I am writing a tool, that runs clang from Xcode path. This tool gets location of Xcode by running /usr/bin/xcode-select, but I want to remake it so that it reads Xcode location directly from disk instead of running xcode-select. I tried to debug xcode-select (which is a symlink to xcrun), but didn’t manage to find how it stores/reads location of Xcode (does it stores it in environment or files?). If you know how to get location of Xcode without running xcode-select (and xcrun), please help! Thanks in advance!
Share
Used dtruss command to print all open syscalls of xcode-select.
It tries to read /usr/share/xcode-select/xcode_dir_path and get Xcode location from there. If it does not exist, it takes the default Xcode location, which is /Applications/Xcode.app/.