git error "unable to locate xcodebuild" after a fresh OS X Mavericks upgrade
Asked Answered
S

12

64

When I try to run previously working git commands, I get this:

dyld: Symbol not found: _sqlite3_intarray_bind
  Referenced from: /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
  Expected in: /opt/local/lib/libsqlite3.dylib
 in /System/Library/Frameworks/CoreData.framework/Versions/A/CoreData
git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

How can I fix this?

Spheroid answered 29/10, 2013 at 0:53 Comment(0)
N
165

This works for me sudo xcode-select --switch /Library/Developer/CommandLineTools/

Neomineomycin answered 3/8, 2015 at 6:17 Comment(7)
I had xcode and another xcode beta. After uninstalling the beta I got "Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool". Then I did this commando and it works again.Thermostatics
I did sudo xcode-select --switch /Applications/Xcode.app but that did not solve my problem. Why did your approach solve the problem?Wept
Dunno how you figured that out, but it worked for me too.Tubulate
You have to make sure the command line tools are installed, when I finally upgraded to sierra, these weren't installed - osxdaily.com/2014/02/12/install-command-line-tools-mac-os-xGabble
It doesn't work for me. I got xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools/'Runnymede
I also got xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools/', for me the solution was to just update the XCode app from Appstore. After that it started working.Crofoot
I ran into this issue when upgrading Sierra -> Catalina and the command shared by @Neomineomycin fixed it for me. Thanks!Pina
S
43

After a much googling and confusion, the following steps lead to a solution (with Xcode installed). Some might be optional, so please feel free to elaborate on this as I am not an expert on these errors.

  • download mavericks command line tools https://developer.apple.com/downloads/
  • xcode-select --install
  • sudo xcode-select -switch /Library/Developer/CommandLineTools
  • brew install sqlite3
  • commented out DYLD_LIBRARY_PATH entry in my .bashrc file
Spheroid answered 29/10, 2013 at 13:29 Comment(7)
You don't need to download mavericks command line tools/be a developer. You can start on step 2. (assuming you have the new xcode, at least)Amar
I'm getting OP's error when trying to install a redmine plugin after updating Command Line Tools to version 6.0 for OSX 10.9. The key takeaway on this was to run the command sudo xcode-select -switch /Library/Developer/CommandLineTools which fixed my error. Thanks!Umbilical
personally i only needed steps 1-3. thanks for this info!Tyrothricin
I only needed step 3Talkathon
STEP2 and STEP3 were enough for meBeowulf
I upgraded Mac Os X from Mojave to Catalina, and got a similar error when running git. I develop in Intellij, not Xcode, but needed the command line tools. The first two commands above resolved this for me.Pinnace
I had upgraded to Big Sur 11.6.3 and had the same issue as the original post. My issue was resolved by performing step 2 and 3 just as a few others here. I initially did step 3 only which prompted the error that the path given in step 2 was not an allowed path. Hopefully this helps a few others with similar but not the exact problem.Hardihood
M
32

On MacOS Mojave this worked for me (git 2.21.0):

xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools
Mutazilite answered 10/10, 2019 at 15:52 Comment(1)
Thanks! Worked on Catalina as well. This is a better answer as the installation (first command) was required.Mailbox
J
14

If you have already installed Xcode, you can run the following command to determine and point to the correct location

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

Or use AppStore to install latest Xcode.

Jinni answered 29/10, 2013 at 3:30 Comment(1)
git stopped working for me after I updated to Catalina. Updating Xcode in the App Store worked for me. Didn't need to switch anything.Metrist
R
12
xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools

This did it for me.

Rebane answered 3/1, 2019 at 7:8 Comment(0)
C
9

Most likely you need to reinstall the command line tools before switching the xcode path to point there.

First install the tools

$ xcode-select --install

This will install the tools into the folder /Library/Developer/CommandLineTools.

Then point the xcode path to where the tools were installed, like this

$ sudo xcode-select -switch /Library/Developer/CommandLineTools

Note: You can see the current xcode path with the command $ xcode-select -p. Mine was initially pointing to /Applications/Xcode.app/Contents/Developer when I was getting the error

Casern answered 6/8, 2019 at 18:37 Comment(0)
R
8

This worked for me in MacOS High Sierra (10.13.6)

sudo xcode-select --switch /Library/Developer/CommandLineTools/

Rost answered 21/3, 2020 at 20:12 Comment(0)
A
3

I met this error when i run the command 'git clone xxx'

dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild Reason: image not found git: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! git: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

Then, run the command

xcode-select -p

pointing to /Applications/Xcode.app/Contents/Developer

After run the command sudo xcode-select -switch /Library/Developer/CommandLineTools

it points to /Library/Developer/CommandLineTools

Abrahan answered 29/9, 2019 at 3:28 Comment(0)
A
2

I hit this same issue running Fastlane on a fresh High Sierra installation. Solved with:

sudo xcode-select --switch /Applications/Xcode.app
Amadis answered 13/5, 2018 at 2:58 Comment(0)
R
0

Maybe you should install Xcode 5.0.1 for Mavericks. Check updates.

Remonaremonetize answered 29/10, 2013 at 2:30 Comment(1)
the problem happens with exactly that config on my computer alsoCunha
E
0

This worked for me, just paste in terminal: sudo xcode-select --switch /Library/Developer/CommandLineTools/

Eggplant answered 21/5, 2018 at 21:24 Comment(0)
S
0

I had the same problem after updating from High Sierra to Monterey. If you just updated MacOS, a simple Xcode update will do. No extra steps are needed.

Satang answered 1/6, 2023 at 4:42 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.