I'm having some issues installing Alamofire 4.0 into my project.
I've got the latest version of Xcode, running Swift 3, and when I try to install alamofire I'm getting like 800 compiler errors.
Apparently
CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+
[!] some_cocoapod requires CocoaPods version >= X.Y.Z, which is not satisfied by your current version, Z.Y.X.
I looked at the version of CocoaPods I have in terminal and it says I'm at 1.0.1.
Running an update didn't work I guess because CocoaPods 1.1 is in beta.
So I'm not exactly sure how to update it up to where I'm good to go.
Unless being out of date doesn't force like 800 compiler errors? Does that sound like some other issue?
Execute the following on your terminal to get the latest stable version:
sudo gem install cocoapods
Add --pre to get the latest pre release:
sudo gem install cocoapods --pre
If you originally installed the cocoapods gem using sudo, you should use that command again.
Later on, when you're actively using CocoaPods by installing pods, you will be notified when new versions become available with a CocoaPods X.X.X is now available, please update message.
Open the Terminal -> copy below command
sudo gem install cocoapods
It will install the latest stable version of cocoapods.
after that, you need to update pod using below command
pod setup
You can check pod version using below command
pod --version
If you got System Integrity Protection enabled or any other permission write error, which is enabled by default since macOS Sierra release, you should update CocoaPods, running this line in terminal:
sudo gem install cocoapods -n/usr/local/bin
After installing, check your pod version:
pod --version
You will get rid of this error:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory
And it will install latest CocoaPods:
Successfully installed cocoapods-x.x.x
Parsing documentation for cocoapods-x.x.x
Installing ri documentation for cocoapods-x.x.x
Done installing documentation for cocoapods after 4 seconds
1 gem installed
If you are using Homebrew, open terminal and type:
brew upgrade cocoapods
If that does not work, try:
brew install cocoapods
After that, run:
brew link --overwrite cocoapods
For those with a sudo-less CocoaPods installation (i.e., you do not want to grant RubyGems admin privileges), you don't need the sudo command to update your CocoaPods installation at all:
gem install cocoapods
You can find out where the CocoaPods gem is installed with:
gem which cocoapods
If this is within your home directory, you should definitely run gem install cocoapods without using sudo.
Finally, to check which CocoaPods you are currently running type:
pod --version
I had to do this, was stuck on 1.9.1 on macOS
sudo gem install -n /usr/local/bin cocoapods
Below are steps to update cocoapods :
Open terminal (Shortcut : Press cmd + space tab to open Spotlight then text in terminal)
Use command sudo gem install cocoapods. This will ask for system password due to security concern thereafter it installs gems
Now, set up pod using pod setup command. This will setup cocoapods master repo.
You can check the version of cocoapods using pod --version command.
Non of the above solved my problem, you can check pod version using two commands:
pod --version
gem which cocoapods
In my case pod --version always showed "1.5.0" while gem which cocopods shows
Library/Ruby/Gems/2.3.0/gems/cocoapods-1.9.0/lib/cocoapods.rb. I tried every thing but unable to update version showed from pod --version. sudo gem install cocopods result in installing latest version but pod --version always showing previous version. Finally I tried these commands:
sudo gem update
sudo gem uninstall cocoapods
sudo gem install cocoapods
pod setup``pod install
The catch for me was sudo gem update. Hopefully it will help any body else.
You can solve this problem by these Commands:
First:
sudo gem install cocoapods
Desp: type user mac password now your cocoapods will be replace with a stable version.
You can find out where the CocoaPods gem is installed with:
gem which cocoapods
if you have cloned the repo then type this command:
pod repo update
close your xcode and run this command
Pod install
This is a really quick & detailed solution
Open the Terminal and execute the following to get the latest stable version:
sudo gem install cocoapods
Add --pre to get the latest pre release:
sudo gem install cocoapods --pre
Incase any error occured
Try uninstall and install again:
sudo gem uninstall cocoapods
sudo gem install cocoapods
Run after updating CocoaPods
sudo gem clean cocoapods
After updating CocoaPods, also need to update Podfile.lock file in your project.
Go to your project directory
pod install
Very Smoot and Easy Solution
//MARK: -Latest stable version:
sudo gem install cocoapods --pre
//MARK: -If not work then
sudo gem install cocoapods --pre -n /usr/local/bin
//MARK: - if upper command not works you can use below mention command as well!
brew install cocoapods
brew upgrade cocoapods
brew link cocoapods
If this
sudo gem install cocoapods
gives you this error:
Could not find a valid gem 'cocoapods' (>= 0) in any repository
Try this:
sudo gem install cocoapods --source http://rubygems.org
I tried updating and it didn't work. Finally , I had to completely remove (manually )cocoapods, cocoapods-core , cocoapods-try.. and any other package used by cocoapods. Use this terminal command to list all the packages:
gem list --local | grep cocoapods
After that , I also deleted ./cocoapods folder from the user's root folder.
After trying all the steps above, with nothing working, I ran bundle update which seems to have done the trick for me.
Refer this link https://guides.cocoapods.org/using/getting-started.html
brew install cocoapods
brew upgrade cocoapods
brew link cocoapods
I have the problem in myproject when pod version and gem which cocoapods always return difference version.
All I had to do is remove Gemfile.lock in my project and bundle install again. It removed the locked cocoapods version and install a newer one.
Hope that helps some one here.
On my M1 Mac, I had a separate version of Homebrew installed for the Silicon/Arm64 side.
brew upgrade cocoapods was defaulting to a rosetta install of homebrew. I kept running it, and couldn't figure out why cocoapods was not updating. So I had to run it in a way that targets the M1 side of things instead of Rosetta.
I had previously aliased the Arm brew to mbrew. So I had to run mbrew upgrade cocoapods
If you updated sudo gem install cocoapods but it's still showing the old version you just need to type bundle update in your terminal to update the bundle and pod --version will show the newest version you installed
write on your terminal this:
sudo gem install cocoapods --pre
for update the gem of cocoapods to lastest version
First check cocoapods versionlike
pod --version
then update like
sudo gem install cocoapods --pre
after update you can also check cocoapods version.
I change the line "pod 'Alamofire', '~> 4.0'" to "pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire', :commit => '3cc5b4e'" after that in terminal: "pod install --repo-update" and it works.
I installed CocoaPods both using the recommended method $sudo gem install cocoapods and sudo-less method with --user-install flag, but in either case when I run $sudo cordova requirements I get the same error below:
CocoaPods: not installed
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
I even successfully ran a CocoaPods setup before running the requirements check. I have also created a .bash_profile with the following entries:
export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:/Users/stephensmith/.gem/ruby/2.3.0/bin:$PATH
O/S is macOS mojave 10.14.1
Any suggestions on how to fix it?
Type following command in your terminal
cd ~/.cocoapods/repos
git clone https://github.com/CocoaPods/Specs.git
This will solve the problem in most of the cases, please see:
https://github.com/CocoaPods/CocoaPods/issues/5744
When I tried to import Realm with CocoaPods like this:
pod install --verbose --no-repo-update
then error happened:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/ColinH/PEGTL' into submodule path '/private/var/folders/51/tzbm7yqs3bsck5vxz3xj5pkc0000gn/T/d20160925-2957-1pu1dou/Realm/ObjectStore/external/pegtl' failed
why?
The above error is mainly caused by the change of the security mechanism of os10.11+ and cocoapods1.0+ version upgrade. Mainly in the pod setup process. And the waiting time for this process is very long
git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master
The same effect as pod setup
Mac OS 10.11, some cocoapods commands to change. If you have a pod setup or pod update problem, and it is difficult to solve, I suggest 10.11. Uninstall reinstall after installation of cocoapods has some different commands, the following summary:
1 check the ruby environment, if necessary, please update as follows
$ sudo gem update --system
2 uninstall cocoapods
$ sudo gem uninstall cocoapods
3 reinstall cocoapods (Setup command has changed)
Before 10.11
$ sudo gem install cocoapods
After 10.11
$ sudo gem install -n /usr/local/bin cocoa pods
4
$ sudo chmod +rx /usr/local/bin
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
//taking CocoaPods Specs repository copy to your computer under directory ~/.cocoapods
pod setup
Iam trying to install cocoa pods in a xcode project, but when doing:
$ pod install
I get the following error:
Setting up CocoaPods master repo
[!] The `master` repo requires CocoaPods 0.32.1 -
Update CocoaPods, or checkout the appropriate tag in the repo.
/Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:281:in `rescue in run': undefined method `verbose?' for nil:NilClass (NoMethodError)
So I updated cocoapods
$ sudo gem update cocoapods
But it tells me there is nothing to update:
Password:
Updating installed gems
Nothing to update
run
pod --version
but I get:
0.31.0
What could it be? Why it is not updating to the latest version (.32.1)?
Xcode: 5.1
ruby: 2.0.0p353
OSX: 10.9.2
To update cocoapods just do
sudo gem install cocoapods
and then you should be at the correct version
This is what worked for me.
Uninstall CocoaPods (choose to uninstall all versions):
sudo gem uninstall cocoapods
Remove old master repo:
sudo rm -fr ~/.cocoapods/repos/master
Install CocoaPods without sudo:
gem install --user-install cocoapods
Setup CocoaPods and Master repo:
pod setup
NOTE: Step 3 is going to make sure you install pod under your user name instead of root which sudo does.
To update the version you must reinstall cocoapods:
sudo gem install cocoapods
The next step is You are going to Have to manually delete any copies of the Specs Local repository and re-clone the new version of the repository Specs. You can do that With the Following commands:
sudo rm -fr ~/.cocoapods/repos/master
pod setup
Finally:
pod install
that's what worked for me:
Uninstall CocoaPods (choose to uninstall all versions):
sudo gem uninstall cocoapods
Remove old master repo:
sudo rm -fr ~/.cocoapods/repos/master
Update gems as user installed:
sudo gem update --system --user-install
Add local gem path:
echo 'export PATH="$PATH:/Users/%username%/.gem/ruby/2.0.0/bin"' >> ~/.bash_login
Install CocoaPods without sudo:
gem install --user-install cocoapods
Setup CocoaPods and Master repo:
pod setup
make sure you are not running no-sudo commands from sudo terminal window/tab and relaunch or add new tap after exporting path
I had the same issue. I tried
sudo gem uninstall cocoapods
and then
sudo gem install cocoapods
but it wasn't working. It finally worked when I restarted Terminal after the uninstall. Then the install worked.
I am getting:
[!] The `master` repo requires CocoaPods 0.18.1 -
Update Cocoapods, or checkout the appropriate tag in the repo.
How to checkout cocoapods?
To update CocoaPods you can run:
$ [sudo] gem update cocoapods
If you would like to try a pre-release version of CocoaPods you can run:
$ [sudo] gem update cocoapods --pre
from here
I had a similar problem and upgrading to cocoapods 0.18.1 is not an option for me (at the moment).
In my case I wanted to stick with cocoapods 0.16.4. So, I double checked to make sure I was not using version 0.18.1.
$ pod --version
0.16.4
If you need to: uninstall any new version of cocoapods (when prompted select which version of cocoapods you want to uninstall):
$ sudo gem uninstall cocoapods
I then switch my local repository from the 'master' to the '0.16' tag. I will be downgrading to repo '0.16' because that is more inline with my version of cocoapods (0.16.4).
$ cd ~/.cocoapods/master/
$ git checkout 0.16
You should now be using repo '0.16' instead of the 'master'.
$ cd ~/.cocoapods/master && git branch
* 0.16
master
Finally, I had to clean up my XCode project workspace by completely re-installing my Pods.
$ cd to/your/project
$ rm -rf Pods/
$ rm Podfile.lock
$ pod install
Now, my cocoapod version matches my repo version. Note: You switched your local repository from the 'master'. You can always switch back to the 'master' repo using git checkout master.
All the other answers didn't help here. I'm no ruby expert, but I think my problem was, that I had 2 Ruby versions installed:
the one that comes with OS X
and one I had installed with rvm (Ruby Version Manager).
When I updated the gems, the wrong gems got updated. The symptom was, that the after the update the command line told me cocoapods was version 0.20.2, but when I did pod --version I got 0.16.0 back.
I guess this could have been corrected with a symlink cleanup at the wright place, but I decided to get rid of the second Ruby installation instead. I found a way to do it here - the answer of Erick.
After that I updated the cocoapod gem with sudo gem update --system, the the cocoapods with sudo gem install cocoapods. Now the pod install worked :-)
I hope the above makes sense. Please edit, if I'm wrong.
Try gem install cocoapods:1.1.1 --user-install
where replace 1.1.1 to your desired virsion