Docker CocoaPods

image credits

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

My CocoaPods is broken, when I call pod I get the message cannot load such file -- 2.6/ffi_c (LoadError) and incompatible library version. This is always the problem with system-wide libraries which are used by different projects and programs. If some application updates the library, then something else might not work, like CocoaPods.

For Python I use virtualenv and for NodeJs the nix-shell. Additionally I use direnv, so that I have the right environment in the terminal window when I open the directory. CocoaPods uses Ruby and probably a similar configuration is possible. However, I just wanted to built an iOS example and therefor I have to install some pods.

Either I spend the evening solving the Ruby and CocoaPods problem and that’s it, or I install a CocoaPods Docker image, look at the iOS example and write a blog post?

You can guess which option I have chosen.

Cocoapods Docker Image

Dockerhub has the renovate/cocoapods image. By calling the following command Docker downloads it, executes pod install and you mount the directory where the Podfile is located with /usr/src/app. That’s all…

docker run \
  --volume $PWD:/usr/src/app \
  renovate/cocoapods \
  pod install

… but this takes a while ⏳ because the spec repository has to be cloned.


To test the iOS example the Docker image was ok, but in the long run I have to fix the Ruby problem.