xcode-select: error: tool ‘xcodebuild’…

Vikas Kore
2 min readMar 23, 2021

--

Here we will see issues occure due to misconfiguration of pods and Xcode on our mac machine

CocoaPods.org

Issue 1. When we have multiple Xcodes installed on our machine or it is not in ‘Applications’ but on any other place i.e. in downloads, desktops

-In this case when you try to install pod we might get error
xcode-select: error: tool ‘xcodebuild’ requires Xcode
-To fix this navigate Xcode to Application folder, or it is there only then hit command
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
for configure actual location

Issue 2. If you are facing issues while installing cocoapods, means that will be issue of some gems installation or there already installed location

-In this case completely Uninstall Cocoapods and reinstall

Issue 3. If Pod version issue

-If you have higher or lower pod version installed on your machine or you are using higher or lower pods version for in you xcode project:
In this case use ‘pod update’ command or use ‘pod repo update’ it now knows of this newer version and can continue to install it.

— — — — — —

First, what is Cocoapods?

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It has over 81 thousand libraries and is used in over 3 million apps. CocoaPods can help you scale your projects elegantly. by cocoapods.org

Install Cocoapods

Open Terminal and enter the following command, that it!
sudo gem install cocoapods

To setup and install pod in Xcode project

Open Terminal and navigate to the folder that contains project
cd ~/Path/To/Folder/Contain/Project’
Then hit command for initialization, This creates a Podfile for your project
pod init’
Hit ‘
open -a Xcode Podfile’ it will open Podfile of your desired project
Under ‘use_frameworks!’ add pod that you want to add and install
Like: pod ‘Alamofire’ then ‘pod install’ command to install pod.
You are done!

Uninstall Cocoapods

First, determine which version(s) of Cocoapods you have installed by running this in Terminal: gem list — local | grep cocoapods
It results:

cocoapods (1.10.1, 1.8.4)
cocoapods-core (1.10.1, 1.8.4)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.4.0, 1.2.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.4.1)
cocoapods-try (1.1.0)

Command ‘pod — version’ will give you version of pod i.e. 1.10.1

Just run the following command to remove all or just a specific cocoapod gem: ‘sudo gem uninstall cocoapods’ or to completely remove, issue the following commands like:

gem uninstall cocoapods
gem uninstall cocoapods-core
gem uninstall cocoapods-downloader

Thank you, Happy coding!

--

--

Vikas Kore
Vikas Kore

No responses yet