search by tags

for the user

adventures into the land of the command line

xcrun: error: invalid active developer path

after upgrading my mac to osx sierra, I found that my command line was showing this error when I tried to use git or brew

$ git status
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

$ brew list
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

turns out after upgrading, some files have gone missing

$ xcode-select --print-path
/Library/Developer/CommandLineTools

$ ls -l /Library/Developer/CommandLineTools/
total 0
drwxr-xr-x  3 root  admin  102 17 Oct 18:05 usr

$ ls -l /Library/Developer/CommandLineTools/usr/
total 0
drwxr-xr-x  3 root  admin  102 17 Oct 18:04 share

the internet tells me the solution is to do this

$ xcode-select --install

hey presto, the files are back and everything’s working

$ ls -l /Library/Developer/CommandLineTools/usr/
total 0
drwxr-xr-x  114 root  admin  3876 18 Oct 11:49 bin
drwxr-xr-x    5 root  admin   170 29 Aug 04:31 include
drwxr-xr-x   48 root  admin  1632 18 Oct 11:49 lib
drwxr-xr-x    5 root  admin   170 29 Aug 04:33 libexec
drwxr-xr-x    9 root  admin   306 18 Oct 11:50 share

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

$ brew list
ansible libyaml node    openssl tree    wget