Mid-2015款McBkPro(High Sierra 10.13.3)xcrun缺失问题求助
Hey, I’ve dealt with this exact error a few times on older Macs running High Sierra—total buzzkill when you’re gearing up for a new project and all your terminal commands die on you. Let’s get this sorted quickly.
The Root Cause
You’re right on the money: the Xcode Command Line Tools are either missing, or your system’s path to them got messed up. These tools are required for almost all development commands (git, npm, homebrew stuff, etc.), so without them, nothing works.
Step-by-Step Fixes
Install (or Reinstall) Command Line Tools via Terminal
This is the easiest way. Open up Terminal and run this command:xcode-select --installA pop-up window will appear asking you to install the tools. Click "Install", agree to the license, and let it finish downloading and installing. Once done, quit and restart Terminal, then try running your project commands again—they should work now.
Reset the Command Line Tools Path (If Installation Doesn’t Help)
Sometimes the system’s path to the tools gets corrupted even if they’re installed. Fix that with:sudo xcode-select --resetYou’ll need to enter your Mac’s admin password (it won’t show up as you type, that’s normal). After running this, check if the path is set correctly with:
xcode-select -pIt should output
/Library/Developer/CommandLineTools. If it shows a path to a full Xcode app (like/Applications/Xcode.app/Contents/Developer) and you don’t have Xcode installed, just re-run the first install command to get the standalone tools.Accept the Xcode License (If Needed)
If you have Xcode installed but never agreed to its license, that can also cause this error. Run this command to accept it:sudo xcodebuild -license acceptEnter your admin password when prompted, and you’re good to go.
Final Check
After any of these steps, test a simple command like git --version or gcc --version to make sure the tools are working. If they output a version number, you’re all set to start your new project!
内容的提问来源于stack exchange,提问作者Frenchmassacre

