Swift.iOS: CocoaPods – How to Install for Terminal Use

In this lesson

Installing CocoaPods for use in Terminal is a fairly easy, straight-forward process, but there are a couple little gotchas or tricks you may encounter. Stay tuned to find out!

Kyle Roberts
Swift Guru at Large

Kyle's Series


Tap on time to skip ahead


Hello world, Kyle here with Brax.tv. Let’s talk about how we can install CocoaPods. We’re at CocoaPods.org. We know what CocoaPods is. We scroll down and here’s the next information we need, which is how to install CocoaPods. It’s pretty simple. Just this command. Basic syntax to install a Ruby gem, gem install cocoapods.


Then, we typically have to use sudo with CocoaPods since it installs outside of the user directory. Sudo just asks for the current user account password. I think as long as it’s an admin, which gives you permission to write outside of your directory. There’s this –pre attribute here that let’s you install pre-releases of CocoaPods’ releases. In my opinion, in my experience they’re usually pretty stable. I’ve never had a problem specifically with a pre-release of CocoaPods. So that’s good.


Again, we can just check this gem install cocoapods here. In terminal, I’ve conveniently installed CocoaPods so we can walk through the install process. I guess, if you’re interested the Ruby gem command for uninstalling a Gem is gem uninstall cocoapods. That’s all I had to do. I did have to add sudo, but that’s not this video.


We’re going to run gem install cocoapods. It’s going to run through some stuff and then it’s going to tell us that we don’t have write permissions for the directory that it’s trying to install into. So I’ll just give that a moment. Wow, that was a small moment. It tells us that exactly, we don’t have write permissions for this directory, which again, is outside of our user of Brax.tv. Then, we want to prefix that with sudo – sudo gem install cocoapods.


Let’s add that –pre attribute to download the pre-release. If you don’t add it, it’s just going to download the latest non-pre-release release. Every now and then, CocoaPods, while you’re using it, will tell you that there’s a pre-release version that you can download and they want you to download it and blah blah blah. So at least when you have the pre-release you don’t get that. You don’t get any additional text to annoy you about the newest version. Which, it’s not really annoying, it’s just there. So this is taking longer since it’s actually doing something. Oh, it’s working now. It’s installed. Now we can check if it is installed. I guess I should have done this before to prove that it wasn’t installed. Just type pod and we get this whole list of help from CocoaPods, which is great. You installed CocoaPods.

Additional Info

Register to get access to additional resources and info.