xcode-select says there is no active developer directory
xcode-select: error: Unable to get active developer directory. Use sudo `xcode-select --switch <path/to/>Xcode.app` to set one (or use the `man xcode-select` command)Short answer
macOS keeps one active developer directory that points at Xcode or the Command Line Tools package. The error means that pointer is empty, stale, or set to the tools package when a command needs the full Xcode app. Print the path, then install the tools or switch the pointer with xcode-select.
Fix it fast
1Find out which cause you have
Print the active developer directory and see what is installed. The output tells you which of the causes below you have.
xcode-select --print-path ls /Applications | grep -i xcode ls /Library/Developer/CommandLineTools2Match what you see, then jump to its fix
- 1
--print-path itself prints the Unable to get active developer directory error, and neither folder existsNo Xcode or Command Line Tools is installed or selectedFix - 2
--print-path fails or prints an old path, while Xcode exists in /Applications or another folderXcode is installed but not selected, or it lives in a non-standard folderFix - 3
--print-path shows /Library/Developer/CommandLineTools, and a tool such as xcodebuild or xctrace failsThe Command Line Tools package is selected, but the command only ships with XcodeFix - 4
Builds or git started failing right after a macOS update, and the Command Line Tools package version is older than the systemThe tools package is out of date after a macOS upgradeFix
- 1
What does the error look like?
xcode-select: error: Unable to get active developer directory. Use sudo `xcode-select --switch <path/to/>Xcode.app` to set one (or use the `man xcode-select` command)
Cause 1 of 4
No Xcode or Command Line Tools is installed or selected
1Check
A fresh macOS has no developer directory. Running a tool such as git normally offers the install by itself.
xcode-select --print-path
ls /Library/Developer/CommandLineTools2Fix
Install the Command Line Tools package, then click Install in the dialog and accept the licence.
xcode-select --install3Verify
The path is printed and no error shows.
xcode-select --print-pathConfirmed by developer.apple.com
Cause 2 of 4
Xcode is installed but not selected, or it lives in a non-standard folder
1Check
The standard location is /Applications/Xcode.app. If you moved or renamed it, for example to /Applications/Xcode26/Xcode.app, you must select that location yourself.
xcode-select --print-path
ls -d /Applications/Xcode*.app2Fix
Point the active developer directory at the Xcode app you want. This needs administrator rights.
sudo xcode-select --switch /Applications/Xcode.app3Verify
The path now ends in Contents/Developer inside that Xcode app.
xcode-select --print-pathConfirmed by developer.apple.com
Cause 3 of 4
The Command Line Tools package is selected, but the command only ships with Xcode
1Check
xcodebuild and xctrace are not in the Command Line Tools package. They need the full Xcode app to be the active developer directory.
xcode-select --print-path
ls /Applications/Xcode.app2Fix
Install Xcode, then switch to it. To try another Xcode for one command only, set DEVELOPER_DIR for that command and leave the global setting alone.
sudo xcode-select --switch /Applications/Xcode.app
env DEVELOPER_DIR="/Applications/Xcode-beta.app" xcodebuild -version3Verify
xcodebuild reports the Xcode version you chose.
xcodebuild -versionConfirmed by developer.apple.com
Cause 4 of 4
The tools package is out of date after a macOS upgrade
1Check
Apple warns that after a macOS upgrade the installed package may be incompatible. Check its version and look for updates.
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
# System Settings > General > Software Update2Fix
Install the update for your macOS from Software Update in System Settings, or with softwareupdate.
# System Settings > General > Software Update > install the Command Line Tools update3Verify
pkgutil reports the new version after the update is installed.
pkgutil --pkg-info=com.apple.pkg.CLTools_ExecutablesConfirmed by developer.apple.com
How do I stop it coming back?
- Keep Xcode at /Applications/Xcode.app, or run xcode-select --switch whenever you move it.
- After each macOS upgrade, check Software Update for a new Command Line Tools release.
- Use DEVELOPER_DIR to try a beta Xcode for one command instead of switching the system setting.
- In CI scripts, print xcode-select --print-path at the start so a wrong selection is visible in the log.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fixMobile apps
App Store Connect rejects a screenshot because it has transparency
Images can't include alpha channels or transparencies.
App Store Connect does not accept screenshots that carry an alpha channel or transparent pixels.
2 causes, each with a fix