3

I updated my mac to macOS Mojave version 10.14, I already had Xcode installed in the previous OS version and now while I run intelliJ this error is thrown:-

Can't start Git: /usr/bin/git Probably the path to Git executable is not valid. Fix it

Screenshot of the error

CHIRAG CHOPRA
  • 41
  • 1
  • 1
  • 5
  • Try to run it from console (with full path). What output do you have? – talex Oct 24 '18 at 05:45
  • How to run it from console ? – CHIRAG CHOPRA Oct 24 '18 at 05:54
  • 1
    *"How to run it from console ?"* - Type "git --version"! Then "which git". But my bet is that you don't have a free-standing "git" installation. So the solution would be to install git! – Stephen C Oct 24 '18 at 05:56
  • @StephenC it will be better to type `/usr/bin/git` because it is what Idea try to run. – talex Oct 24 '18 at 05:57
  • Except that "/usr/bin/git" is not correct. See the error message! – Stephen C Oct 24 '18 at 05:58
  • I don't have experience with Mac, but google said you can try this https://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line – talex Oct 24 '18 at 05:58
  • when i typed git it throwed this error git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' – CHIRAG CHOPRA Oct 24 '18 at 06:00
  • @StephenC I think that's default path for git. We need to find out why it is error. There is several option here: file don't exist, file is not accessible, file is corrupted. Running it in console can give us a clue about what is actually happened. – talex Oct 24 '18 at 06:01
  • You could try this .... https://stackoverflow.com/questions/30388636/git-error-sdk-macosx-cannot-be-located – Stephen C Oct 24 '18 at 06:02
  • Or this https://stackoverflow.com/questions/52665394/git-error-unable-to-read-sdk-settings-for-macosx-sdk. In fact, my guess is that your Q is a dup of this one. Basically, it says you need to **update** your XCode installation. – Stephen C Oct 24 '18 at 06:03
  • I encountered this issue as well with IntelliJ @StephenC but I did not get the error described in that question from terminal, only from IntelliJ. I posted the steps which worked to resolve the issue IntelliJ was having. – Ian G Feb 08 '19 at 15:42

3 Answers3

11

To solve this problem you need to install xcode developer tools.

Run this command, the problem will be fixed:

xcode-select --install

I had the same problem after upgrade and this solved it.

piet.t
  • 11,718
  • 21
  • 43
  • 52
Patryk Rudnicki
  • 755
  • 1
  • 8
  • 21
4

I performed the following steps to solve this problem:

  1. Run sudo xcode-select --switch /Application/Xcode.app/Contents/Developer (this step may be optional)
  2. Open App Store
  3. Update xcode
  4. Wait for update to complete before continuing with next steps
  5. Run sudo xcodebuild -license
  6. Press enter key to view agreement (to page down the agreement hold space or press it multiple times)
  7. Once at the end of the agreement if you agree type agree and press enter
  8. Close and re-open IntelliJ and GIT should work again.

I hope this helps others!

Ian G
  • 498
  • 3
  • 16
  • when running `sudo xcodebuild -license` i get this error message: `xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance` – Avishay28 Oct 30 '21 at 11:28
  • You have xcode installed? Could the active dev directory be incorrect? – Ian G Jan 10 '22 at 17:52
1

I ran into the same error on mac after updating the OS to Ventura. Tried the above solutions which did not solve the error,

xcode-select: error: command line tools are already installed, use "Software Update" in System Settings to install updates

What worked: System Settings --> Privacy and Security --> Developer Tools
Toggle the button next to Terminal

ScreenShot

Akash A N
  • 11
  • 1