2
1

More than 1 year has passed since last update.

gitコマンドが使えなくなったのを、元通り使えるようにしたい。(原因は、macOS のアップデートを実行したため)

Posted at

原因は、macOS のアップデートだったから、これからも同様のことがあるだろうけど、その度に忘れて、その度に簡単に解決するやん、となることでしょう。(今回も既に2回目だった)

1. やりたいことを確認する。

  • gitコマンドが使えなくなったのを、元通り使えるようにしたい。

2. 課題(エラーの状況、不明点、エラーログ)を確認する。

⚠️ git cloneしようとしたら失敗した。

$ git clone https://github.com/xxx/xxx.git
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

⚠️ そのほかのgitコマンドも使えない。

3. 調査する(ググる、ドキュメントを読む)

macOS High SierraからMojaveにアップデート後、gitコマンドを利用しようとしたら以下のエラーが出ました。

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

以下のコマンドを実行し、xcodeをインストールすれば解決できます。

xcode-select --install

そういえば最近macOSアップデートを実行したなぁ…。

4. 調査結果からの考察、対策を実行する

🧑🏻‍💻 調べたコマンドを実行する。

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

🧑🏻‍💻 ソフトウェアをインストールする。

🧑🏻‍💻 使えることを確認する。(解決!)

$ git status
On branch feature-xxx
Your branch is up to date with 'origin/feature-xxx'.

nothing to commit, working tree clean
2
1
0

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
2
1