Command Line Tool - Error - xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

Command LineInstallationSwift3GzipCarthage

Command Line Problem Overview


I am getting this error while building the SwiftJSON framework to the Some Xcode project through Carthage Dependency Manager.

> Sivaramaiahs-Mac-mini:GZipDemoApp vsoftMacmini5$ carthage update > --platform iOS > > *** Fetching GzipSwift > > *** Fetching SwiftyJSON > > *** Checking out GzipSwift at "3.1.1" > > *** Downloading SwiftyJSON.framework binary at "3.1.3" > > > *** xcodebuild output can be found in /var/folders/7m/y0r2mdhn0f16zz1nlt34ypzr0000gn/T/carthage-xcodebuild.apLXCc.log > > A shell task (/usr/bin/xcrun xcodebuild -project > /Users/vsoftMacmini5/Desktop/GZipDemoApp/Carthage/Checkouts/GzipSwift/Gzip.xcodeproj > CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) > failed with exit code 72: > > xcrun: error: unable to find utility "xcodebuild", not a developer > tool or in PATH

Command Line Solutions


Solution 1 - Command Line

I solved that problem by setting the Command Line Tools in Xcode. Go to:

> Xcode > Preferences > Locations

And select the command line tool from the dropdown. If you have only one version of Xcode installed, there should be only one option. If you have several versions of Xcode, then you must choose the one you need.

Update (added image for reference)

enter image description here

Solution 2 - Command Line

The simplest fix is from CLI:

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

(this should be path to your Xcode.app)

By the way this can happen even if you have only one version of Xcode . It happens when you instal homebrew before the first Xcode installation (which makes sense because you may want to install Xcode through mas install 497799835 and mas needs homebrew).

Solution 3 - Command Line

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer. Worked for me

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSivaram YadavView Question on Stackoverflow
Solution 1 - Command LineAdriana PinedaView Answer on Stackoverflow
Solution 2 - Command LinevolView Answer on Stackoverflow
Solution 3 - Command LineVinitaView Answer on Stackoverflow