LoginSignup
47
17

More than 3 years have passed since last update.

`xcode-select: note: install requested for command line developer tools`あるいは`xcode-select: error: command line tools are already installed, use “Software Update” to install updates`の対処法

Posted at

TAをしていて,git clone が動かない方がいたので動かない場合の対処法を書きます.

この場合は,xcodeのせいでした.

環境

macos catalina 10.15
xcode 11.4

原因

xcode command line toolsをインストールしてもうまくいかず,xcodeのcommand line toolsのパスがおかしいことが原因でした.

対処法

command line toolsをインストールする

  1. 自分のmacにxcodeがない場合,インストールする(必要ないが,念の為)
  2. ターミナルで“xcode-select --install”をする
  3. “xcode-select: note: install requested for command line developer tools”とエラーが返る場合は,公式サイト から自分のmacos,xcodeのバージョンに合ったcommand line toolsをダウンロードし,解凍,インストーラにしたがってインストールする

ダウンロードしたのに変わらない場合,パスがおかしいかもしれない

“xcode-select --install”を実行したときに
“xcode-select: error: command line tools are already installed, use “Software Update” to install updates”と表示される場合,xcodeとcommand line toolsのパスがおかしい可能性があります.

パスを確認する方法があります.

  1. “xcode-select -p”を実行してみます.
  2. “/Applications/Xcode.app/Contents/Developer”と表示されるとパスがこの場合よくないと考えられます.(developerツール使う場合はあるけれど)
  3. “sudo xcode-select -switch /Library/Developer/CommandLineTools”を実行します.
  4. 再度xcode-select -pを実行し、“/Library/Developer/CommandLineTools”と出力されれば,git cloneはできるはずです.

終わりに

command line tools が動かないと,brew とかgitとかコマンドラインから使うツールがいつかえなくなるようです.

参考資料

パスの参考にしたサイトhttps://techracho.bpsinc.jp/hachi8833/2016_09_09/25454

47
17
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
47
17