Error on pod install - cocoapods

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

Related

CocoaPods folder does not exist / permissions error

I'm new to CocoaPods, I tried running 'pod install' on my Mac to install my pod, but I'm getting a permissions error with the folder /Users/username/Library/Caches/CocoaPods. That folder doesn't even exist! Did I accidentally delete it at one point? How do I restore it?
There is however a folder called /Library/Caches but its not under my username, its at the root.
I'm a little confused. If someone can just direct me in the right direction, I would really appreciate it.
Here is the full error message:
Errno::EACCES - Permission denied # dir_s_mkdir - /Users/nachshonfertel/Library/Caches/CocoaPods
You can solve this in 2 ways.
Add CocoaPods folder on ~/Library/Caches/CocoaPods then try
pod install
OR
Give full permission on you project
cd your-project
chmod -R 777 .
cd ios
pod install
Turns out it was a permissions error. And the folder I thought didn't exist, was hidden in finder > Go > (Hold Down Option Key) Library
Took me 2 full days to finally figure it out!
Are you using system Ruby or have you installed Ruby with sudo?
You basically have 2 options:
use sudo pod install
Probably the easiest/fastest way for you go forward
This typically causes more problems than Ruby being owned by non-root
When you install packages they will have sudo access!
Install Ruby, non-sudo; you can try
github.com/postmodern/ruby-install together with github.com/postmodern/chruby (my personal favourite), rvm.io is also very popular
The benefit of this approach is that you also can switch Ruby version whenever you like (and as mentioned above; more secure less insecure..)
I had been struggling with this issue for a while. For some reason, in my case the problem was that the folder ~/Library/Caches/CocoaPods was not there, and cocoapods wasn't able to create it when running 'pod install'. Hence the permission error.
After trying several things, I created that folder manually (which prompted for my password), ran 'pod update' and my problem was fixed!
Hope this saves someone some trouble.
I solved the problem creating the missing folder Users (in my case the error was Permission denied # dir_s_mkdir - /Users/Users) and give full permission to all users.
I managed to solve my issue in following steps:
Create CocoaPods folder (if it doesn't exist) cd ~/Library/Caches && mkdir CocoaPods
Give access to CocoaPods folder sudo chmod 777 Cocoapods
Create Pods folder cd CocoaPods && mkdir Pods
Give access to Pods folder sudo chmod 777 Pods
I hope it helps !

Pod Install in Xcode Bots Trigger

I started the pre integration trigger with the following
cd "${XCS_PRIMARY_REPO_DIR}"
pwd
pod install --verbose
And it gave me
pod: command not found
Simple right? Can't find the pod binary so, I'll just point it over to the path. Easy.
cd "${XCS_PRIMARY_REPO_DIR}"
pwd
/usr/local/bin/pod install --verbose
Which gives me the following
env: ruby_executable_hooks: No such file or directory
This makes me think ruby isn't set up right to run for the triggers. Now understand a simple "pod install" in the terminal of the build server fixes all this and runs fine and dandy. The project definitely builds properly on the build server.
So since I think the environment is messed up, I'll try to run it from the wrapper directory, that should set up good and nice. That's what it's made for right? This worked historically whenever I needed ruby to run in a run script phase of the build. So here we go on the trigger.
~/.rvm/wrappers/ruby-2.2.3#global/pod install
I test this one in the terminal of the build server and it's cool with it, so I put it into the trigger and I get this
/Users/XcodeServer/.rvm/wrappers/ruby-2.2.3#global/pod: line 7: exec: pod: not found
:/ Alright I crack up the pod source and see what it says on line 7
exec pod "$#"
I'm not a ruby person but it didn't mean anything to me. Oh yeah and I tried downloading cocoapods directly into usr/local/bin, rather than letting it install into some other directory, by first uninstalling all cocoapods and then by doing the following
sudo gem install -n /usr/local/bin cocoapods --pre
I put --pre because I needed 1.1.0.rc.2 to fix a bug with building swift 3. Any who, it all doesn't work. It seems like everyone else can simply put
cd /path/to/proj/
pod install
into their Xcode bot triggers and have them work.
I had the trigger run a script on the build server that did the pod install.
So make a shell script on your build server that has the following:
#make sure the encoding is correct
export LANG=en_US.UTF-8
# fix the path so Ruby can find it's binaries
export PATH=/usr/local/bin:$PATH
echo "PATH: $PATH"
# update or install depending on what we got
if [ -d ${PODS_DIR} ]; then
# pods directory exist
echo "=================="
echo " Delete Pods"
echo "=================="
# delete cocoapods files if they exist
rm -rf "${PODS_DIR}"
eval rm "${BS_SRCROOT}/Podfile.lock"
eval rm -rf "${BS_SRCROOT}/${BS_EXECUTABLE_NAME}.workspace"
echo "Deleted Pods directory ${PODS_DIR}"
echo "Deleted ${BS_EXECUTABLE_NAME}.workspace"
echo "Deleted Podfile.lock"
else
# no need to delete pod files
echo "Pods NOT detected at ${PODS_DIR}"
fi
echo "=================="
echo " Install Pods"
echo "=================="
# make sure we are where we need to be
eval cd "${BS_SRCROOT}"
pwd
~/.rvm/wrappers/ruby-2.2.3#global/pod install
Remember to use the 'sh' suffix when naming the script. And then in your bot trigger run the script like this
sh ~/Path/to/Scripts/podUpdateHack.sh
Kind of silly but it works, ¯\_(ツ)_/¯ Oh yeah all those dumb evals are there because the BS_SRCROOT is an environment variable on XCode bots, which references the environment variable $XCS_PRIMARY_REPO_DIR. You can just replace it with $XCS_PRIMARY_REPO_DIR and remove the eval. I don't remember who defines PODS_DIR that might be from the workspace and BS_EXECUTABLE_NAME is a redefinition of the executable name from the project since it doesn't exist at this point in time.
Hope that helps homie.
#!/bin/sh
cd ProjectDirectory
/usr/local/bin/pod install
Set the default path, execute the .bash_profile and then your bot runs just like a normal user
#!/bin/sh
cd $XCS_PRIMARY_REPO_DIR
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands"
. ~/.bash_profile
bundle install
pod install --repo-update
P.s. bundle install installs all gems specified in my Gemfile which looks like this (So you can have different gem requirements per bot):
source 'https://rubygems.org'
gem 'cocoapods', '1.3.1'

Cocoapods permissions No such file or dirrectory

I have a problem here. I've installed cocoapods on my Mac because I need it for my XCode project. I've runned this command
gem install cocoapods
which works fine, all things were installed. But I after that when I tried to use any pod COMMAND thing, I've got the error - You cannot run CocoaPods as root.
I've looked through stackoverflow, and the main advices were to use this commands
sudo chown -R $USER ~/.cocoapods or sudo chown -R $USER ~/Library/Caches/CocoaPods
but the problem is none of those commands were working for me and I've got this error:
chown: /Users/user/.cocoapods: No such file or directory
Could you tell me where I'm wrong?
Ok, guys, I've figured out the problem. Just need to do what the error says. You shouldn't run pod install command with sudo or from the root user. It means - just open new terminal window and don't log to the root user and work with pod

pod setup fail at 'Setting up CocoaPods master repo'

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

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

Resources