Six Command Line Tools For Cocoa Developers
A surprising number of developers loathes the command line. Admittedly, the command line is a bit scary at first, especially if you are used to graphical user interfaces. But to get work done and to get work done efficiently, it is often better and more convenient to open a Terminal window and execute a few commands from the command line. And, to be honest, using the command line is just cool. You know it is.
"And, to be honest, using the command line is just cool. You know it is." — Me
Over the years, a handful of command line tools have become an integral part of my development workflow. In this article, I would like to focus on six command line tools that make my professional life that much easier.
The Missing Package Manager for macOS
Homebrew is probably the most popular package manager for macOS. It makes installing third party packages a breeze. Homebrew not only makes the installation easy, it also configures and sets up the packages for you. If you use macOS on a daily basis and the command line doesn't scare you too much, then I strongly recommend checking out Homebrew.
cdCommand That Learns
I am always surprised by how few people use this nifty little tool. autojump makes it easy to navigate the file system from the command line. It keeps a history of the files and folders you have visited and lets you jump between them, using shortcuts. Let me show you how it works.
Imagine that you are working on a project that is deeply nested in your home folder. The path to the project folder may look something like this:
Whenever I open a new Terminal or iTerm window, it opens in the home folder. Instead of using the
cd command to navigate to my destination, I type
j scecret to jump to the above project folder.
autojump automatically ranks the locations you have visited and figures out which ones best match your query. Seriously. Install autojump. You can thank me later.
Groom Your App's Ruby Environment
This command line tool is indispensable if your workflow includes Ruby. If you use CocoaPods, for example, then Ruby is something you rely on to get work done. rbenv, short for ruby environment, manages Ruby environments. None other than Sam Stephenson of Basecamp fame (formerly 37signals created rbenv several years ago.
rbenv is similar to RVM, but it is less intrusive and easier to work with. That is a personal opinion of course. People often wonder what is best for their workflow, rbenv or RVM. Take a look at this GitHub page to get a better understanding of the differences.
You can install rbenv through Homebrew. Installing a new Ruby version is as simple as executing the following command:
rbenv install 2.2.4
rbenv can manage multiple Ruby versions and it makes switching Ruby versions simple.
rbenv local 2.2.4
You can also set the global Ruby version of your system with one command.
rbenv global 2.2.4
Earlier today, I ran into an incompatibility issue with CocoaPods and Ruby 2.3.0. Switching to Ruby 2.2.4 took me exactly five seconds. Problem solved.
The Cocoa Dependency Manager
Many Cocoa developers use CocoaPods for managing dependencies. If you do, then I don't have to convince you of the value of a robust dependency manager, such as CocoaPods.
In addition to managing dependencies, CocoaPods makes it also easy to lint pod specs and push them to the master or a private specs repository. Check out the complete list of commands to find out what other commands may be useful in your workflow.
iOS Automation for Continuous Delivery
You may have read that Fabric acquired fastlane in October of last year. I am not sure if that is a good thing, but development of this fantastic suite of command line utilities has never been more active.
The creator of fastlane, Felix Krause, has done an amazing job, making tedious tasks faster, easier, and automated. If you have not tried out fastlane yet, then you may want to start by watching a talk Felix recently gave about fastlane.
Cross-Platform Static Analyzer and Linter For Swift
Last week, I wrote about Tailor, a wonderful tool to enforce a set of guidelines and best practices to write beautiful Swift.
Development of this static analyzer and linter is very active. The team behind Tailor is committed to making it robust and up to date. The development team is very responsive and open to feedback. If you are new to Swift and want to stick with a set of proven guidelines, then Tailor helps you do that.
What Tools Do You Use?
I am always curious to hear what tools other developers use to speed up common tasks. Drop your suggestions in the comments below or reach out to me on Twitter.