Updating Cocoapods

August 9, 2018 ยท 4 minute read

So in my next app project I want to use RealmSwift and have Cocoapods manage its libraries for me, but it has been awhile since I’ve used it on a project.

I’ve already downloaded Homebrew (I personally like using it to manage packages), but had a feeling that there might have been some updates and clean up to do before I started using pods in my projects again.

I made sure to look at the pod I wanted to use, RealmSwift to make sure I had the correct version of Cocoapods, etc. And I had older version - time to update.

This is going to be fun!

First things first, what version do I have on my machine (“$” denotes the command line, type what comes after it, which is the actual command):

$ gem which cocoapods
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods.rb

Yup, its outdated. And just to make sure how outdated it really is:

$ pod repo update
...
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your diff.renameLimit variable to at least 17865 and retry the command.

Time to call the brew doctor:

$ brew doctor

And here is what the doctor prescribed:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  /Library/Frameworks/Python.framework/Versions/3.6/bin/python3-config
  /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6-config
  /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6m-config

Warning: Ruby version 2.3.7 is unsupported on 10.13. Homebrew
is developed and tested on Ruby 2.3.3, and may not work correctly
on other Rubies. Patches are accepted as long as they don't cause breakage
on supported Rubies.

Warning: Your Xcode (9.3.1) is outdated.
Please update to Xcode 9.4 (or delete it).
Xcode can be updated from the App Store.


Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/etc/bash_completion.d/_brew_services

Apparently Xcode stopped talking to the mothership, because I didn’t get the notification to update it from 9.3 to 9.4 - bastards!

So after manually removing it from my machine and about an hour of downloading the new version and getting it set up and running again, I went through and reinstalled Ruby, which also erred out (oh, what fun!) with:

The `brew link` step did not complete successfully

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/rake
Target /usr/local/bin/rake
already exists. You may want to remove it:
  rm '/usr/local/bin/rake'

To force the link and overwrite all conflicting files:
  brew link --overwrite ruby

To list all files that would be deleted:
  brew link --overwrite --dry-run ruby

Possible conflicting files are:
/usr/local/bin/rake
/usr/local/share/emacs/site-lisp/autoconf/autoconf-mode.el
/usr/local/share/emacs/site-lisp/autoconf/autoconf-mode.elc
/usr/local/share/emacs/site-lisp/autoconf/autotest-mode.el
/usr/local/share/emacs/site-lisp/autoconf/autotest-mode.elc

So after getting that error, I just decided to try to link Ruby anyway just to see what errors would occur. This updating thing is just oozing with fun…

$ brew link ruby
Linking /usr/local/Cellar/ruby/2.5.1... 
Error: Could not symlink bin/rake
Target /usr/local/bin/rake
already exists. You may want to remove it:
  rm '/usr/local/bin/rake'

To force the link and overwrite all conflicting files:
  brew link --overwrite ruby

To list all files that would be deleted:
  brew link --overwrite --dry-run ruby

I decided to do a dry run first, before removing files.

$ brew link --overwrite --dry-run ruby
Would remove:
/usr/local/bin/rake
/usr/local/share/emacs/site-lisp/autoconf/autoconf-mode.el
/usr/local/share/emacs/site-lisp/autoconf/autoconf-mode.elc
/usr/local/share/emacs/site-lisp/autoconf/autotest-mode.el
/usr/local/share/emacs/site-lisp/autoconf/autotest-mode.elc

I removed all the files, at this point, I really don’t give a hoot. I tried linking Ruby again = Success!

$ brew link ruby
Linking /usr/local/Cellar/ruby/2.5.1... 3293 symlinks created

After doing all brew doctor suggestions, here’s what I got:

$ brew doctor
Your system is ready to brew.

And since I blew out the Cocoapods library, I installed it again:

$ gem which cocoapods
ERROR:  Can't find Ruby library file or shared library cocoapods

$ gem install cocoapods

... a bunch of gobbly-gook outputted and appeared here, indicating that it was downloading a bunch of shite ...

$ gem which cocoapods
/usr/local/lib/ruby/gems/2.5.0/gems/cocoapods-1.5.3/lib/cocoapods.rb

Then when I reran the command to update Cocoapods, everything updated without a hitch.

$ pod repo update
Updating spec repo `master`
  $ /usr/bin/git -C /Users/.../.cocoapods/repos/master fetch origin --progress
  remote: Counting objects: 1346, done.        
  remote: Compressing objects: 100% (181/181), done.        
  remote: Total 1346 (delta 675), reused 613 (delta 606), pack-reused 550        
  Receiving objects: 100% (1346/1346), 177.50 KiB | 8.45 MiB/s, done.
  Resolving deltas: 100% (853/853), completed with 286 local objects.
  From git://github.com/CocoaPods/Specs
     60b2e1f4512..b7fb5bd264f  master     -> origin/master
  $ /usr/bin/git -C /Users/.../.cocoapods/repos/master rev-parse --abbrev-ref
  HEAD
  master
  $ /usr/bin/git -C /Users/.../.cocoapods/repos/master reset --hard
  origin/master
  HEAD is now at b7fb5bd264f [Add] Fidel 1.3.2

Oh, the joys of updating sh!te in Terminal.

Subscribe to my email list for a monthly newsletter and special updates!