gyp: No Xcode or CLT version

Did you recently update your macOS Catalina to version 10.15.2? If you did, then you probably in the same boat too. What I immediately noticed from my terminal is this new shinny error about gyp: No Xcode or CLT version detected any time I ran either yarn install or npm install

gyp: No Xcode or CLT version detected!
gyp ERR! configure error

Well if you are wondering if that was my entire error? It is not even close. The line goes on and on. The funny thing is am so sure I have command line tools installed. The result of xcode-select --install should start the reinstallation process but if you get the result in the image below then you already have command line tools installed

gyp: No Xcode or CLT version
xcode-select: error: command line tools are already installed, use “Software Update” to install updates

Solution 1

Run the following command with sudo to reset your command-line tools. Provide your systems password if needed.

sudo xcode-select --reset

The above command should work in most cases, but if for some reasons it does not work for you, then you can go through the lengthy process of a reinstall as outlined in solution 2

Solution 2

Reinstall command line tools by removing the previously installed version

Step 1

First, get the location of the installed command line tools by running the command below:

xcode-select --print-path

the result of the above command /Library/Developer/CommandLineTools

Step 2

Knowing the path to the currently installed command line tools from the previous step, You can now go ahead and remove it from the system. For the next set of commands, you need sudo privileges to run successfully.

sudo rm -r -f /Library/Developer/CommandLineTools

Provide the root password to remove the command line tools. If you already have git installed, you would get a prompt to guide you through the installation of command line developer tools.

Prompt to reinstall command line developer tools

Click on install and follow the rest of the instructions in prompt to reinstall command line developer tools. If for some reasons, you do not get the prompt right after uninstalling your previous command line developer tools, no need to panic. Run the following command to get the prompt.

xcode-select --install
Prompt after running xcode-select –install

Click on install and then agree to the licence to proceed with the installation. Depending on your internet speed it will take some time for the system to complete the download of the command line developer tools. The installation process should proceed immediately after a successful download. Look out for the done button as shown in the image below to confirm command line tools is successfully installed.

With the reinstallation of the command line developer tools the gyp: No Xcode or CLT version detected error message should disappear when you run any yarn or npm commands from the command line.

Solution 3

Following solution 2, in some rear situations, you might get the subsequent error.

Can’t install the software because it is not currently available from the Software Update server

The command-line tools need to be manually downloaded to solve the aforementioned error. The step-by-step solution is detailed below.

Step 1

Remove previously installed command-line tools with the following command.

sudo rm -r -f /Library/Developer/CommandLineTools

Step 2

Visit the apple developer site to manually download the command-line tools.

https://developer.apple.com/download/more/?=command%20line%20toolsSign in with your Apple IDSign in with your Apple IDSign in with your Apple IDdeveloper.apple.com

Log in with your apple id when prompted to proceed to the download page.

Image for post
log in screen

Step 3

Select the version of command-line tools to download, as of the time of writing this article the recommended version is 12.2

Image for post
Click on the hard drive image to download

Click on the dmg link as shown in the image above to begin the download of the command-line tools.

Step 4

Open or mount the downloaded dmg and double click the command-line-tools.pkg file in the mounted dmg file.

Image for post
mounted command-line developer tools dmg

Follow the prompts to complete the installation of the command-line tools

Image for post
Click continue and follow the prompts
Image for post
Agree to the Software licence agreement by clicking on the continue button
Image for post
Click on agree
Image for post
Click on install
Image for post
Provide your user credentials to continue the installation
Image for post
Installation continues
Image for post
Installation completed screen. Click on close to dismiss
People reacted to this story.
Show comments Hide comments
Comments to: gyp: No Xcode or CLT version detected macOS Catalina
  • October 16, 2020

    Thanks a million, had the exact same problem

    Reply
    • November 21, 2020

      Glad to help

      Reply
  • April 30, 2021

    Sadly I\’ve bookmarked this post and have had to do this many many times. I\’m doing it for the second time this week! Earlier #2 worked, today it didn\’t, now doing #3. Any thoughts on why? Is there something to investigate to stop this from happening?

    Reply
    • May 27, 2021

      Sadly no for now. Will definitely update, when there is a better alternative.

      Reply
  • June 25, 2021

    Thanks a lot, being looking for this solution for days!!!

    Reply
Write a response

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.
%d bloggers like this: