45

This is very much a duplicate of xcode-select active developer directory error except none of those solutions worked for me.

$ sudo xcode-select --reset
$ sudo xcodebuild -license accept                                  
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
$ sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

I don't even have xcode on my machine.

1

5 Answers 5

98

The fix for me here was that my [ XCode > Preferences > Locations > Command Line Tools ] dropdown was empty. No idea why. But after clicking it and selecting the only available option my "active developer directory" error finally went away.

Mac Os 12.3.1 | Date: 5/4/22

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! Such a trivialty... completely lacking feedback... I can now use the opendiff command-line on my brand new machine. There's a dark spot in the transparency and you helped me through it.
As of 2024, it's now XCode > Settings. Otherwise, it's still working.
For me, it does show a value at the beginning, but was probably still in a weird state. After re-selecting the value for this dropdown, it worked. Thanks!
28

If you're looking for a simple command that can fix this, and your xcode is installed in the default location (/Applications/Xcode.app), you can fix this with this command:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

2 Comments

worked! (filler text, ignore)
For me this only worked after using the gui preferences fix from stackoverflow.com/a/72115137/805031 ... then instead of needing to reopen another shell, I believe your solution saved me from that hassle, thanks!
15

I had this problem because Xcode was installed in my user application directory (~/Applications) instead of /Applications. From the Github link above figured out I needed to run:

sudo xcode-select -s ~/Applications/Xcode.app/Contents/Developer

(note the tilde). After this everything worked.

Comments

3

I had "xcode-select active developer directory error" too when installing Xcode beta. In your case you don't even need full Xcode, command line tools should work fine. Read this Github issue

Comments

-5

This error completely contradicts that setting the path to /Library/Developer/CommandLineTools is the workaround for the latest XCode/MacOS combo failing to find the command line tool commands under /Application/Xcode.App/ with the default path setting.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.