Installing Xcode on Apple Silicon
Published
Updated
How to install Xcode via the CLI
You can install Xcode on a Mac by running the following command in the terminal:
xcode-select --install
How to update your Xcode installation when using Homebrew
Error: Your Xcode (13.4.1) is too outdated.
Please update to Xcode 14.1 (or delete it).
Xcode can be updated from the App Store.
When running a homebrew brew
command, you may see errors related to the version of Xcode you have installed. Simply update Xcode to the latest version using the xcode-select --install
command and it will be resolved. Unfortunately Apple doesn’t allow older, unmaintained versions of Xcode to persist and this is a common annoyance as major versions are released.
How to install multiple versions of Xcode
There is an excellent tool called Xcodes. You can install it via Homebrew using the following command:
brew install --cask xcodes
You can then find it in your launchpad. Simply click the version you want to open or manage.
How to find the Xcode installation path
You can run xcode-select -p
to print out the installation location of Xcode:
xcode-select -p
/Applications/Xcode.app/Contents/Developer
How to reset your Xcode cli tools path
If your Xcode installation has been incorrectly set, you can reset it to the default using the following command:
sudo xcode-select -r
Changing your Xcode developer tools path
If you have multiple versions or need to adjust the path, you can switch it using the following command. Change the path to match the new location:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Error: invalid active developer path (/library/Developer/CommandLineTools)
This error usually happens whenever there is a semi or major update on MacOS.
Sometimes it will also give you the error: missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Make sure you install any outstanding MacOS updates and then run:
xcode-select --install
Failed to prepare device for development.
This operation can fail if the version of the OS on the device is incompatible with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
This error can happen when your version of Xcode needs to be updated as it been outdated by a semi or major update. Run xcode-select --install
to fix this.