For many years, I was a hardcore Linux user. Naturally, any servers I interacted with ran Linux, but so did my desktop. I was a fluent terminal user in Linux and often found it quicker to drop to the command line than to try to accomplish tasks in the GUI.
A couple of years ago I switched my main machine from a beat-up old Dell running Ubuntu to a shiny new MacBook. I wasn’t disillusioned with Linux, but as I became busier I found less time to spend creating the perfect Linux desktop experience and I wanted something that just worked. MacOS, then OS X, is Unix-based and has many of the same terminal apps as Linux, but the environment isn’t quite the same. Often the installed versions of tools are even older than they are on an LTS Ubuntu installation or CentOS, and, of course, Linux package managers aren’t available on a Mac.
Today, I’m just as fast in the terminal as I ever was on Linux, so I’d like to share four Mac tools that you won’t find on Linux, but that I’ve found invaluable to getting my work done.
Homebrew is a must-have for me. It’s a package manager with many of the same features as Linux package managers, although it’s missing some of the finer qualities of apt or yum.
With brew, Mac command line users can install all their favourite terminal applications and more up-to-date versions of tools than are installed by default.
If you want a quick and easy way to get vim, git, and anything else you might want to use on the command line, brew is your friend.
Brew isn’t installed by default, but you can find full installation instructions on its website.
pbcopy / pbpaste
Getting content from the terminal into the GUI environment is an everyday task for me. Whether it’s copying the result of an AWK script for sending in an email or grabbing the filtered output of a log file to paste into Slack, pbcopy and pbpaste are the right tools for the job.
As their names suggest, content piped into the standard input of pbcopy is saved in the system clipboard, and pbpaste emits the contents of the system clipboard from its standard out.
Open simply opens files in the default GUI application. I use it all the time for Markdown files in code repositories. I browse the repositories in the terminal, but I prefer to edit documentation files in a GUI application like iA Writer.
Naturally, the “find” command is available in MacOS terminal, and so is the “locate” command, although its database isn’t generated by default and it won’t work without some configuration. Usually, I don’t bother with locate because mdfind is a more capable tool. mdfind gives terminal users access to Spotlight indexes. It’s a powerful tool that can be used to search and filter by many different file attributes.
Perhaps to my shame, I often find myself trying to use these commands when I’m ssh’d into a Linux server. They’ve become part of my muscle memory. Do you have any favourite MacOS command line utilities you’d like to share? Let us know in the comments.