xcode-select active developer directory error


Question or issue on macOS:

Saw the following error when running an npm install which required node-gyp… but could be triggered by anything which requires xcode-select.

What is the problem?

How to solve this problem?

Solution no. 1:

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)


  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

Solution no. 2:

Other solution for those who don’t want to install Xcode:

  1. Install Command Line Tools (if you haven’t already):

    xcode-select --install

  2. Change the active directory:

    sudo xcode-select -switch /Library/Developer/CommandLineTools

This worked for me (git).

Solution no. 3:

I was having an issue while trying to install packages using npm.
I got the error: “sudo xcode-select -s /Applications//Xcode.app/Contents/Developer/”

To fix this

  • I opened Xcode.
  • Preferences
  • Locations
  • Selected the Command Lin Tools: Xcode 6.1.1

Now when installing packages with npm I no longer get errors.

Solution no. 4:

Xcode->Preferences->Locations->command line tools


Select the option: Xcode 8.x

Solution no. 5:

Simply run sudo xcode-select -r which should automatically reset the path.

 -r, --reset
              Unsets any user-specified developer directory, so that the developer directory will be found via the default search mechanism. This command must  be
              run with superuser permissions (see sudo(8)), and will affect all users on the system.

Solution no. 6:

Just in case you’re using xcode beta:

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

Solution no. 7:

I had to run this first

sudo xcode-select --reset


sudo xcode-select -switch /Library/Developer/CommandLineTools

and then it worked.

Solution no. 8:

Download Xcode from App Store.
Go to Xcode preferences/Locations/CommandlineTools

You just have to set it to the Xcode version. It automatically points to ‘/Application/Xcode.app’

Solution no. 9:

Type this in your terminal

xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept

Solution no. 10:

Install Xcode from App Store. After installing run xcodebuild with root privileges i.e. sudo xcodebuild and accept the language. After this npm install bcrypt worked like a charm!

Hope this helps!