Command Line Tools not working - OS X El Capitan,

2019-01-02 16:50发布

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?

14条回答
倾城一夜雪
2楼-- · 2019-01-02 17:04

Reassigning the path Xcode is configured with worked for me.

sudo xcode-select -switch /Applications/Xcode.app

You'll then likely be prompted (after trying a command) to agree to the license agreement.

查看更多
深知你不懂我心
3楼-- · 2019-01-02 17:05

For the most recent version Mojave version 10.14.1, I use

solved by downloaded from https://developer.apple.com/download/more/ " login by apple id, and download

Command line tool newest stable version.dmg

That makes everything work

the old answer

xcode-select --install

doesn't work for me.

查看更多
查无此人
4楼-- · 2019-01-02 17:08

For those also having issues with heroku command line tools after upgrading, I also had to do the following in my terminal:

xcode-select --install 
brew install heroku/brew/heroku
brew link --overwrite heroku

It seems the upgrade to High Sierra messed with my symlinks in addition to forcing me to reinstall xcode tools. I kept getting 'not a directory' errors:

▸ stat /Users/mattymc/.local/share/heroku/client/bin/heroku: not a directory  
▸ fork/exec /Users/mattmcinnis/.local/share/heroku/client/bin/heroku: not a directory 

Hope that saves someone an hour :)

查看更多
宁负流年不负卿
5楼-- · 2019-01-02 17:13

Found the fix for the problem here.

xcode-select --install

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

查看更多
流年柔荑漫光年
6楼-- · 2019-01-02 17:16

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

查看更多
梦寄多情
7楼-- · 2019-01-02 17:16

Updated to High Sierra 10.13.2

xcode-select --install ALONE did not work for me.

  1. Download X-code from app store
  2. $xcode-select --install
    a. May need to update after install using softwareupdate in command line. $sudo softwareupdate -i "Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.1"

  3. $sudo xcodebuild -license

查看更多
登录 后发表回答