Invalid Active Developer Path on MAC Os X After Installing Ruby

Invalid active developer path on MAC OS X after installing Ruby

Partial diagnosis: https://github.com/microsoft/vcpkg/issues/8781#issuecomment-547248760

It seems that upgrading from one MacOS version to another either uninstalls some dev tools or it moves them to another path, and this breaks compatibility with any tool using the environment variable that points to the old location where the tools were located.

sudo xcode-select --install

Using the install command worked for me, but it is not clear whether this simply downloaded and unpacked files and then skipped installation and simply updated an environment variable or whether it physically installed the files at the expected path. (Or it could have made links to the new folder path).

Testing my theory, I probe the folder structure with ls (I should have done this before using the install command):

rej@Ryans-MacBook-Air:~$ ls /Library/Developer/CommandLineTools/usr/bin/
rej@Ryans-MacBook-Air:~$ ls -la /Library/Developer/CommandLineTools/usr/bin/
total 243776
drwxr-xr-x 124 root wheel 3.9K Oct 28 23:03 ./
drwxr-xr-x 7 root admin 224B Oct 28 23:05 ../
lrwxr-xr-x 1 root wheel 64B Oct 28 23:03 2to3@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/2to3
lrwxr-xr-x 1 root wheel 68B Oct 28 23:03 2to3-3.7@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/2to3-3.7
-rwxr-xr-x 1 root wheel 116K Sep 5 22:51 DeRez*
-rwxr-xr-x 1 root wheel 31K Sep 5 22:51 GetFileInfo*
-rwxr-xr-x 1 root wheel 33K Sep 5 22:51 ResMerger*
-rwxr-xr-x 1 root wheel 126K Sep 5 22:51 Rez*
-rwxr-xr-x 1 root wheel 31K Sep 5 22:51 SetFile*
-rwxr-xr-x 1 root wheel 32K Sep 5 22:51 SplitForks*
-rwxr-xr-x 1 root wheel 41K Sep 5 22:51 ar*
-rwxr-xr-x 1 root wheel 40K Sep 5 22:51 as*
-rwxr-xr-x 1 root wheel 27K Sep 5 22:51 asa*
-rwxr-xr-x 1 root wheel 216K Sep 5 22:51 bison*
-rwxr-xr-x 1 root wheel 159K Sep 5 22:51 bitcode_strip*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 c++@ -> clang
-rwxr-xr-x 1 root admin 31K Sep 5 22:51 c89*
-rwxr-xr-x 1 root admin 31K Sep 5 22:51 c99*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 cc@ -> clang
-rwxr-xr-x 1 root wheel 80M Sep 5 22:51 clang*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 clang++@ -> clang
-rwxr-xr-x 1 root wheel 125K Sep 5 22:51 cmpdylib*
-rwxr-xr-x 1 root wheel 154K Sep 5 22:51 codesign_allocate*
lrwxr-xr-x 1 root wheel 17B Oct 28 23:03 codesign_allocate-p@ -> codesign_allocate
-rwxr-xr-x 1 root admin 3.3K Aug 16 06:55 cpp*
-rwxr-xr-x 1 root wheel 36K Sep 5 22:51 ctags*
-rwxr-xr-x 1 root wheel 150K Sep 5 22:51 ctf_insert*
-rwxr-xr-x 1 root wheel 30M Sep 5 22:51 dsymutil*
lrwxr-xr-x 1 root wheel 14B Oct 28 23:03 dwarfdump@ -> llvm-dwarfdump
-rwxr-xr-x 1 root wheel 477K Sep 5 22:51 dwarfdump-classic*
-rwxr-xr-x 1 root wheel 211K Sep 5 22:51 dyldinfo*
-rwxr-xr-x 1 root wheel 239B Sep 5 19:18 easy_install-3.7*
-rwxr-xr-x 1 root wheel 572K Sep 5 22:51 flex*
-rwxr-xr-x 1 root wheel 572K Sep 5 22:51 flex++*
lrwxr-xr-x 1 root wheel 3B Oct 28 23:03 g++@ -> gcc
-rwxr-xr-x 1 root wheel 101K Aug 16 07:31 gatherheaderdoc*
-rwxr-xr-x 1 root admin 27K Sep 5 22:51 gcc*
lrwxr-xr-x 1 root wheel 8B Oct 28 23:03 gcov@ -> llvm-cov
-rwxr-xr-x 1 root wheel 2.4M Sep 5 22:51 git*
lrwxr-xr-x 1 root wheel 3B Oct 28 23:03 git-receive-pack@ -> git
-rwxr-xr-x 1 root wheel 1.4M Sep 5 22:51 git-shell*
lrwxr-xr-x 1 root wheel 3B Oct 28 23:03 git-upload-archive@ -> git
lrwxr-xr-x 1 root wheel 3B Oct 28 23:03 git-upload-pack@ -> git
-rwxr-xr-x 1 root wheel 148K Sep 5 22:51 gm4*
-rwxr-xr-x 1 root wheel 166K Sep 5 22:51 gnumake*
-rwxr-xr-x 1 root wheel 98K Sep 5 22:51 gperf*
-rwxr-xr-x 1 root wheel 33K Sep 5 22:51 hdxml2manxml*
-rwxr-xr-x 1 root wheel 158K Aug 16 07:31 headerdoc2html*
-rwxr-xr-x 1 root wheel 73K Sep 5 22:51 indent*
-rwxr-xr-x 1 root wheel 142K Sep 5 22:51 install_name_tool*
-rwxr-xr-x 1 root wheel 2.5M Sep 5 22:51 ld*
-rwxr-xr-x 1 root wheel 230B Aug 16 07:13 lex*
-rwxr-xr-x 1 root wheel 163K Sep 5 22:51 libtool*
-rwxr-xr-x 1 root wheel 73K Sep 5 22:51 lipo*
-rwxr-xr-x 1 root wheel 332K Sep 5 22:51 lldb*
-rwxr-xr-x 1 root wheel 3.6M Sep 5 22:51 llvm-cov*
-rwxr-xr-x 1 root wheel 7.9M Sep 5 22:51 llvm-dwarfdump*
-rwxr-xr-x 1 root wheel 9.8M Sep 5 22:51 llvm-nm*
-rwxr-xr-x 1 root wheel 11M Sep 5 22:51 llvm-objdump*
-rwxr-xr-x 1 root wheel 40K Sep 5 22:51 llvm-otool*
-rwxr-xr-x 1 root wheel 1.6M Sep 5 22:51 llvm-profdata*
-rwxr-xr-x 1 root wheel 2.9M Sep 5 22:51 llvm-size*
-rwxr-xr-x 1 root wheel 3.5K Aug 16 07:19 lorder*
-rwxr-xr-x 1 root wheel 148K Sep 5 22:51 m4*
-rwxr-xr-x 1 root wheel 166K Sep 5 22:51 make*
-rwxr-xr-x 1 root wheel 7.7K Aug 16 07:16 mig*
lrwxr-xr-x 1 root wheel 7B Oct 28 23:03 nm@ -> llvm-nm
-rwxr-xr-x 1 root wheel 142K Sep 5 22:51 nm-classic*
-rwxr-xr-x 1 root wheel 171K Sep 5 22:51 nmedit*
lrwxr-xr-x 1 root wheel 12B Oct 28 23:03 objdump@ -> llvm-objdump
lrwxr-xr-x 1 root wheel 10B Oct 28 23:03 otool@ -> llvm-otool
-rwxr-xr-x 1 root wheel 644K Sep 5 22:51 otool-classic*
-rwxr-xr-x 1 root wheel 138K Sep 5 22:51 pagestuff*
-rwxr-xr-x 1 root wheel 221B Sep 5 19:18 pip3*
-rwxr-xr-x 1 root wheel 221B Sep 5 19:18 pip3.7*
-rwxr-xr-x 1 root wheel 32K Sep 5 22:51 projectInfo*
lrwxr-xr-x 1 root wheel 66B Oct 28 23:03 pydoc3@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/pydoc3
lrwxr-xr-x 1 root wheel 68B Oct 28 23:03 pydoc3.7@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/pydoc3.7
lrwxr-xr-x 1 root wheel 67B Oct 28 23:03 python3@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3
lrwxr-xr-x 1 root wheel 74B Oct 28 23:03 python3-config@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3-config
lrwxr-xr-x 1 root wheel 69B Oct 28 23:03 python3.7@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3.7
lrwxr-xr-x 1 root wheel 76B Oct 28 23:03 python3.7-config@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3.7-config
lrwxr-xr-x 1 root wheel 70B Oct 28 23:03 python3.7m@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3.7m
lrwxr-xr-x 1 root wheel 77B Oct 28 23:03 python3.7m-config@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/python3.7m-config
lrwxr-xr-x 1 root wheel 66B Oct 28 23:03 pyvenv@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/pyvenv
lrwxr-xr-x 1 root wheel 70B Oct 28 23:03 pyvenv-3.7@ -> ../../Library/Frameworks/Python3.framework/Versions/3.7/bin/pyvenv-3.7
lrwxr-xr-x 1 root wheel 7B Oct 28 23:03 ranlib@ -> libtool
-rwxr-xr-x 1 root wheel 70K Sep 5 22:51 resolveLinks*
-rwxr-xr-x 1 root wheel 85K Sep 5 22:51 rpcgen*
-rwxr-xr-x 1 root wheel 56K Sep 5 22:51 segedit*
lrwxr-xr-x 1 root wheel 12B Oct 28 23:03 size@ -> size-classic
-rwxr-xr-x 1 root wheel 125K Sep 5 22:51 size-classic*
-rwxr-xr-x 1 root admin 138K Sep 5 22:51 stapler*
-rwxr-xr-x 1 root wheel 126K Sep 5 22:51 strings*
-rwxr-xr-x 1 root wheel 179K Sep 5 22:51 strip*
-rwxr-xr-x 1 root wheel 330K Sep 5 22:51 svn*
-rwxr-xr-x 1 root wheel 118K Sep 5 22:51 svnadmin*
-rwxr-xr-x 1 root wheel 105K Sep 5 22:51 svnbench*
-rwxr-xr-x 1 root wheel 64K Sep 5 22:51 svndumpfilter*
-rwxr-xr-x 1 root wheel 71K Sep 5 22:51 svnfsfs*
-rwxr-xr-x 1 root wheel 98K Sep 5 22:51 svnlook*
-rwxr-xr-x 1 root wheel 70K Sep 5 22:51 svnmucc*
-rwxr-xr-x 1 root wheel 89K Sep 5 22:51 svnrdump*
-rwxr-xr-x 1 root wheel 122K Sep 5 22:51 svnserve*
-rwxr-xr-x 1 root wheel 90K Sep 5 22:51 svnsync*
-rwxr-xr-x 1 root wheel 44K Sep 5 22:51 svnversion*
-rwxr-xr-x 1 root wheel 90M Sep 5 22:51 swift*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 swift-autolink-extract@ -> swift
-rwxr-xr-x 1 root admin 6.1M Sep 5 22:51 swift-build*
-rwxr-xr-x 1 root admin 734K Sep 5 22:51 swift-build-tool*
-rwxr-xr-x 1 root wheel 687K Sep 5 22:51 swift-demangle*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 swift-format@ -> swift
-rwxr-xr-x 1 root admin 6.1M Sep 5 22:51 swift-package*
-rwxr-xr-x 1 root admin 6.1M Sep 5 22:51 swift-run*
-rwxr-xr-x 1 root wheel 61K Sep 5 22:51 swift-stdlib-tool*
-rwxr-xr-x 1 root admin 6.1M Sep 5 22:51 swift-test*
lrwxr-xr-x 1 root wheel 5B Oct 28 23:03 swiftc@ -> swift
-rwxr-xr-x 1 root wheel 12M Sep 5 22:51 tapi*
-rwxr-xr-x 1 root wheel 41K Sep 5 22:51 unifdef*
-rwxr-xr-x 1 root wheel 2.9K Aug 16 07:19 unifdefall*
-rwxr-xr-x 1 root wheel 63K Sep 5 22:51 unwinddump*
-rwxr-xr-x 1 root wheel 49K Sep 5 22:51 vtool*
-rwxr-xr-x 1 root wheel 45K Sep 5 22:51 xml2man*
-rwxr-xr-x 1 root wheel 135B Aug 16 07:22 yacc*

It is apparent that the files are physically located at that folder location and the installer installed missing components. The fact that MacOS's upgrade process uninstalls my development environment is unfriendly and Apple should be reprimanded.

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

The problem is that Xcode Command-line Tools needs to be updated.

** UPDATED FOR Sept. 2022 M1 MacBook Pro **

After opening the terminal after a restart, I tried to go to my code, and do a git status, and I got an error and prompt for command line software agreement.

So press space until you get to the [agree, print, cancel] option, so careful hit space to scroll down to the end, if you blow past It you have to run a command to get it back. Use sudo xcodebuild -license to get to it again.

Just be careful on scrolling down and enter agree and press return and it will launch into an update.

Xcode software license

Then I tried to use git after the install, and it prompted me to install Xcode tools again.

I followed my own advice from previous years (see below), and went to https://developer.apple.com/download/more/ and downloaded
"Command Line Tools for Xcode 14" (You have to log in with your Apple ID, so have that login readily available.

developer download page selection for "Command Line Tools for Xcode 14"

** I am not sure if this step is needed, but I did it all the same as that's what worked the previous years.

Before you can use git, you need to reboot. This completed the install and git is now working.

Solutions for previous years, these may or may not be valid these days as the downloads page has changed significantly:

PREVIOUS YEARS SOLUTIONS, probably #2 is most helpful.

** Solution #1 **

Go back to your terminal and enter:

xcode-select --install

You'll then receive the following output:

xcode-select: note: install requested for command line developer tools

You will then be prompted in a window to update Xcode Command Line tools. (which may take a while)

Open a new terminal window and your development tools should be returned.

Addition: With any major or semi-major update you'll need to update the command line tools in order to get them functioning properly again. Check Xcode with any update. This goes beyond Mojave...

After that restart your terminal

Alternatively, IF that fails, and it very well might.... you'll get a pop-up box saying "Software not found on server", see below!

Solution #2

and you hit xcode-select --install and it doesn't find the software, log into Apple Developer, and install it via webpage.

Log in or sign up here:

https://developer.apple.com/download/more/

Look for: "Command Line Tools for Xcode 14.x" in the list of downloads
Then click the dmg and download.

image of apple developer page and dmg for DL

xcrun: error: active developer path… does not exist, use xcode-select --switch when trying to run git. How to fix?

So from discussion in the comments above, it seems the right fix here is just to run the command /usr/bin/xcode-select -switch once (i.e., run it with the full path to the executable, rather than just as xcode-select) with /Applications/Xcode.app/Contents/Developer/ as the argument:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer

After running that once, everything should work as expected from then on.

xcode-select active developer directory error

This problem happens when xcode-select developer directory was pointing to /Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)

Solution:

  1. Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don't have it yet.
  2. Accept the Terms and Conditions.
  3. Ensure Xcode app is in the /Applications directory (NOT /Users/{user}/Applications).
  4. Point xcode-select to the Xcode app Developer directory using the following command:

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

Note: Make sure your Xcode app path is correct.

  • Xcode: /Applications/Xcode.app/Contents/Developer
  • Xcode-beta: /Applications/Xcode-beta.app/Contents/Developer

I tried rvm install 2.1 and I got this error xcode-select: error: invalid developer directory

Please run xcode-select --install to update it to the last version.

If you still have the issue, please check you xcode-select path with xcode-select -p and find the correct path to assign it.

In my case my path is:
/Library/Developer/CommandLineTools

so to change the path just run: sudo xcode-select -switch /Library/Developer/CommandLineTools

Ruby version not identified on Mac

This issue is quite probably that you're still using the ruby version that ships with MacOS (the one under /usr/bin/ruby) rather than the one installed by homebrew (which is under /usr/local/bin/ruby.

First, check which version you're actually using by executing the following command in the terminal:

which ruby

If this says /usr/bin/ruby instead of /usr/local/bin/ruby, you can add the following at the end of your .bashrc or .zshrc to allow the terminal to use the executables from /usr/local/bin over /usr/bin:

export PATH="/usr/local/bin:$PATH"

Now if you open a new terminal window, which ruby should point to the one installed by homebrew



Related Topics



Leave a reply



Submit