Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command Line Tools not working - OS X El Capitan, Sierra, High Sierra, Mojave

I just upgraded from Yosemite to El Capitan (and replicated the problem upgrading from El Capitan to Sierra), and when I try to type for example git status inside a terminal, I get the following error:

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

I don't have Xcode installed, never did. Anyone have a solution?

like image 597
rista404 Avatar asked Oct 01 '15 17:10

rista404


People also ask

How do I know if Xcode is installed on my Mac?

We'll use Finder to find out if XCode is installed. In Finder, select the Go pull-down menu, and select Applications. Or just use the short-cut key Command-Shift-A while Finder is active. This should open a new Finder window, showing all the Applications installed on your machine.

What is Apple command line tools?

The Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS. It consists of the macOS SDK and command-line tools such as Clang, which are installed in the /Library/Developer/CommandLineTools directory.


3 Answers

Found the fix for the problem here.

xcode-select --install

This will bring up a prompt to install the necessary command line tools.

like image 121
cuadraman Avatar answered Oct 18 '22 01:10

cuadraman


If you have issues with the xcode-select --install command; e.g. I kept getting a network problem timeout, then try downloading the dmg at developer.apple.com/downloads (Command line tools OS X 10.11) for Xcode 7.1

like image 87
Ryan Heitner Avatar answered Oct 18 '22 03:10

Ryan Heitner


In macOS 10.14 this issue may also occur if you have two or more versions installed. If you like xCode GUI you can do it by going into preferences - CMD + ,, selecting Locations tab and choosing version of Command Line Tools. Please refer to the attached print screen.

enter image description here

like image 11
grzebyk Avatar answered Oct 18 '22 02:10

grzebyk