pod setup fail at 'Setting up CocoaPods master repo' - xcode

I'm trying to install cocoapods and it always fail at 'Setting up CocoaPods master repo' with below error code:
[!] /usr/bin/git clone 'https://github.com/CocoaPods/Specs.git' master --depth=1
sh: line 1: 8018 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find git 2> /dev/null
git: error: unable to find utility "git", not a developer tool or in PATH
I've tried all the suggestions on StackOverFlow like uninstall and re-install cocoapods or rm -fr ~/.cocoapods/repos/master but it still fail.
I'm using xCode 6.1.1 with the newest Command Line Tool on Yosemite 10.10

After a few days going crazy with it. I found a workaround to resolve this problem. It's a workaround because I don't know the root cause and I have to repeat these steps every time I want to do command relates with cocoapods.
Seems like the PATH variable for cocoapods has been changed in Yosemite 10.10, so you need to fix the PATH for cocoapods to understand it.
First, I have to use this command:
sudo rm -fr ~/.cocoapods/repos/master
Then this:
pod setup
And this:
export PATH="/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH"
After that, I could use 'pod setup', 'pod install', 'pod search',... normally as I did before.
Does anybody know how to completely resolve this problem? Because everytime I want to update the pods, I have to repeat those steps above

I was able to fix this by running in term:
gem update
pod install

Related

React-Native Error + Bug in Ruby Interpreter: Failed to install CocoaPods dependencies for iOS project, which is required by this template

I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for DoubleConversion from
../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for RCT-Folly from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec for glog from
../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG]
Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision
67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
In my case, need to restart my terminal before execute pod install. Monterey + M1.
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list
Do the same for the Release .
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

I can not do a "pod install" in CocoaPods

I can not do a "pod install" in any project.
But the thing is that before it could.
What has changed from before to now?
Basically I have installed the new Xcode 10.1 and the new Mojave operating system.
Before I could do all the pod functions and not now. The error that I get is the following:
The Podfile is the following:
EDIT:
If I write:
xcode-select -p
If I write:
xcode-select -s /Applications/Xcode.app/Contents/Developer
Any idea what it can be? Nor did I just see what the error is. Do you see it? I have tried different solutions than those proposed but they do not work ... It's stressful !!
Execute this command in Terminal and try again:
xcode-select -s /Applications/Xcode.app/Contents/Developer
And be sure to update your Cocoapods spec repository by running pod repo update before pod install
Description:
The error is because the wrong path was set as the Xcode Command Line Tools. this can lead to many problems such as git error, C compiler error etc.
Always be sure your Xcode Command Line Tools path has been set to embedded Command Line Tools in Xcode app.

since I installed Xcode 7.1.1 and updatet on osx 10.11.1 I get a git error

Like mentioned in the topic I updated xcode to version 7.1.1 and osx to version 10.11.1 after that I received errors when trying to compile a project with cocoa pods inside. When I try to run "pod install" I receive:
Creating shallow clone of spec repo master from https://github.com/CocoaPods/Specs.git
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named master.
You can try adding it manually in ~/.cocoapods/repos or via pod repo add.
I tried to add the repo manually but then I get:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
sh: line 1: 3405 Segmentation fault: 11 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find git 2> /dev/null
git: error: unable to find utility "git", not a developer tool or in PATH
when I tried to use "git --version" I get:
sh: line 1: 3408 Segmentation fault: 11 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find git 2> /dev/null
git: error: unable to find utility "git", not a developer tool or in PATH
So I tried to add the PATH manually but i weren't able get it work
my echo $PATH delivers:
/usr/local/mysql/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
and my echo $DYLD_LIBRARY_PATH:
/usr/local/mysql/lib/
Does anyone have a clue how i can fix that problem?
thank you very much :)
Today I had the same error.
1) cd ~/.cocoapods/repos
2) git clone git://github.com/CocoaPods/Specs.git master
(use git protocol, I failed when try to do that via https)
3) pod install --no-repo-update --verbose
I didn't have the exact same issue with cocoapods, but I also got the git error after updating to Xcode 7.1.1 (still on OSX 10.10.5):
error: unable to find utility "git", not a developer tool or in PATH
Simply restarting the terminal fixed the problem for me.

Can't run sudo pod install after updating to cocoapods 0.32.1 with error "You cannot run CocoaPods as root. (CLAide::Help)"

I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.
When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.
± sudo pod install ruby-1.9.3-p0
Password:
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
CocoaPods, the Objective-C library package manager.
Commands:....
Any suggestion to overcome the issue would be very helpful. Thanks in advance.
I had to update permission on CocoaPods
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.
sudo chown -R $USER ./Pods
I have removed the old podfile.lock before running pod install
Source :
cocoaPods pod install Permission denied
https://github.com/CocoaPods/CocoaPods/issues/509
I am working with windows. After reading all tips which didn't work I drove into the code base.
As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.
In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.
#help! 'You cannot run CocoaPods as root.' if Process.uid == 0
Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.
Nothing worked for me except the following
switched to ios platform with cd platforms/ios
switched ownership of the folder to the current user with sudo chown -R YourUsername .
Pod install
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D

Error on pod install

I have a working project the uses a pod file for some weeks now. When I learned that some of my pods have update I tried to 'pod install' on got this weird error
Analyzing dependencies
[!] Pod::Executable pull
Updating 1337455..e9f6e93
error: The following untracked working tree files would be overwritten by merge:
AeroGear-Push/0.7.0/AeroGear-Push.podspec
AeroGear/1.2.0/AeroGear.podspec
BrynKit/1.3.0/BrynKit.podspec
BrynKit/1.3.1/BrynKit.podspec
CSURITemplate/0.3/CSURITemplate.podspec
EXiLE/1.0.2/EXiLE.podspec
FlurrySDK/4.2.3/FlurrySDK.podspec
FoundationExtension/0.39.1/FoundationExtension.podspec
FoundationExtension/0.39/FoundationExtension.podspec
GCDObjects/0.0.1/GCDObjects.podspec
HTAutocompleteTextField/1.2.1/HTAutocompleteTextField.podspec
HTAutocompleteTextField/1.2.2/HTAutocompleteTextField.podspec
HTAutocompleteTextField/1.2/HTAutocompleteTextField.podspec
IDMPhotoBrowser/1.1.2/IDMPhotoBrowser.podspec
Igor/0.5.0/Igor.podspec
KFOpenWeatherMapAPI/0.2.0/KFOpenWeatherMapAPI.podspec
NGSegmentedViewController/0.1.1/NGSegmentedViewController.podspec
PPiFlatSegmentedControl/1.3/PPiFlatSegmentedControl.podspec
PiwikTracker/2.0.0/PiwikTracker.podspec
SDWebImage/3.4/SDWebImage.podspec
libwbxml/0.11.2/libwbxml.podspec
wbxml/0.0.1/wbxml.podspec
Please move or remove them before you can merge.
Aborting
another post suggested using the 'rm -rf ~/.cocoapods' command line
but this caused my cocoapods to stop working all together for all project
now which ever project I try to 'pod install' I get the 'Unable to find a specification for..' error
[!] Unable to find a specification for CorePlot (= 1.3).
If you landed here on or after January 30th 2014, there is a break in CocoaPods causing this. Please read the related blog post found here: http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
or do:
pod repo remove master
pod setup
The solution is to use $sudo rm -rf ~/.cocoapods to clean the cocoapods master repo and then pod install worked without any problems.
The 100% dead-work one-line command is:
sudo rm -rf ~/.cocoapods && pod setup && pod install
I created the issue on GitHub traker:#2185
And the official answer is:
This is issue which has already been
fixed by #irrationalfab with commit CocoaPods/CLAide#5e023ab.
So the fix should be available in the next release of CocoaPods. Just be patient
If you need a clean master spec repo you can try
cd ~/.cocoapods/master
git reset --hard
or if you're on CocoaPods 0.23+, use ~/.cocoapods/repos/master.
You are going to have to manually delete any local copies of the Specs repository and re-clone the new version of the Specs repository. You can do that with the following commands:
$ sudo rm -fr ~/.cocoapods/repos/master
$ pod setup
when my projects get big and I have a large pod file, I run into this problem quite a bit.
My solution is as follows :
pod repo remove master
pod setup
pod install
You need to fix permissions and files owner
$ sudo chown -R user ~/Library/Caches/CocoaPods
$ sudo chown -R user ./Pods
$ sudo chown -R user ./Podfile.lock
$ sudo chmod -R 777 ./Pods
$ pod update/setup
Wow this one has been a real pain and everyone seems to have a different solution. For me this solution worked on multiple machines/environments on a few occasions:
Apparently there is a bug with psych that is causing the problem.
sudo gem uninstall psych
sudo gem install psych -v 2.0.0
There's a lengthy conversation over on the CococaPods repo about the issue and this fix.
Just to share my own fix for this issue:
Since this is a git issue, you can use simple git commands to resolve it (See #AdamSharp's post). What worked for me was running
git clean -d -f
in ~/.cocoapods/repos/master. This recursively removes any untracked files and directories from the repo. I encourage you to run:
git clean -d -f --dry-run
Before you actually execute anything so you can see what it would do. Should it break your CocoaPods master repo, simply delete ~/.cocoapods/repos/master and run pod repo update.
You can try it like this.
pod spec lint --sources='https://git.oschina.net/yourname/jqcpodspec,https://github.com/CocoaPods/Specs' --allow-warnings --use-libraries
if your spec pass validation, then
pod repo push JQCPodSpec FMCommonModelLib.podspec --sources='https://git.oschina.net/yourname/jqcpodspec,https://github.com/CocoaPods/Specs' --allow-warnings --use-libraries

Resources