How to check if command line tools is installed

后端 未结 10 2129
执念已碎
执念已碎 2020-11-30 18:02

I have a macbook pro with OS X 10.8.2. XCode is installed. I know this as it appears in the Applications directory. There are also the xcodebuild and xcode-select files in /

10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 18:29

    In macOS Catalina, and possibly some earlier versions, you can find out where the command line tools are installed using:

    xcode-select -p a.k.a. xcode-select --print-path

    Which will, if it is installed, respond with something like:

    /Library/Developer/CommandLineTools

    To find out which version you have installed there, you can use:

    xcode-select -v a.k.a. xcode-select --version

    Which will return something like:

    xcode-select version 2370.

    However, if you attempt to upgrade it to the latest version, assuming it is installed, using this:

    xcode-select --install

    You will receive in response:

    xcode-select: error: command line tools are already installed, use "Software Update" to install updates

    Which rather erroneously gives the impression you need to use Spotlight find something called 'Software Update'. In actual fact, you need to continue in the Terminal, and use this:

    softwareupdate -i -a a.k.a. softwareupdate --install --all

    Which tries to update everything it can and may well respond with:

    Software Update Tool
    
    Finding available software
    No new software available.
    

    To find out which versions of the different Apple SDKs are installed on your machine, use this:

    xcodebuild -showsdks

提交回复
热议问题