Mac OS X “application installation automation” – now say that 3 times quickly!
This is a post about Homebrew and Cask, two package management projects for OS X CLI and GUI applications respectively, and why they’re so useful when it comes to setting a new Apple Mac.
This week I started a new job at VMware. Yes, I’ve moved on from Coho Data (an awesome scale-out, high performance, high-bandwidth enabled, distributed, shared nothing, enterprise-class, freakishly good storage product – give them a call if you have storage needs for VMware, docker images, OpenStack, Big Data, etc).
I’ve joined VMware’s Validated Design team within the Integrated Systems business unit as one of their product managers. There’s lots of super interesting work going on there, and very cool, smart folks to learn from. I’m sure I’ll be writing some articles here about what we’re up to in the coming months. Trust me, if you’re an architect or engineer responsible for designing and/or implementing VMware solutions in your datacenter, then the technology this team is working on will have a material impact on how you do what you do in the next couple of years. If you get the chance to speak to anyone from this team at VMworld, your local VMUG, etc, then ask them why and take the time to listen carefully.
So starting a new job means amongst many other (far more important) things, setting up your new work computer. OS X has its App Store, which should in theory make this sort of menial task a breeze. Installing all your must-have apps on a smartphone is easy-peasy, especially if you’ve already been living in the same ecosystem with your previous phone. And yes, in fact, Apple’s App Store for Macs does something pretty similar – you log into your account and it lists all the apps you had previously installed via the App Store. The problem is only about 10% of the tools and applications I use on a Mac are listed in Apple’s walled garden. There’s lots of reasons why, but fundamentally most application developers don’t agree with Apple’s T&C and know that most folks are happy to roam across to their website to chase down each app. But where’s automation potential there? If each one take 10 minutes to find and install, multiplied by say 50 (yeah, you’d be surprised how much stuff you install), that means I’m spending a chunk of my first week at work not figuring out the coffee situation (seriously , that only makes it to #5? facepalm).
(Now, in reality my shiny new MacBook Pro is waiting for me at home, while I’m in Palo Alto for my first week. But I’ll be following these instructions once I actually get my paws on it.)
Homebrew – what’s this?
This is where I started looking for a tool with a more ubiquitous reach.
I’ve used Homebrew before. If you’re familiar with Linux package managers such as apt-get
for Debian, then you’ll understand the concept. Brew focuses on CLI tools and packages. You may also have heard of MacPorts and Fink, but Homebrew is arguably most popular of the trio these days. Homebrew refers to each package as a formulae and currently they’re over 3,500 different formulaes to pick from in their default repository. Pretty much any non-UI tool, application, app stack you can think of for a Mac is in there. And it’s trivial to use.
Cask – what’s that?
Great, but OS X has this wonderous Graphical User Interface thing that I sometimes like to use to search for pictures of cats, and other critical work related things. This is where Cask comes to the rescue. It’s its own distinct project (separate team), but they’ve taken the Homebrew ethos and way of doing things, and extended it to the most common UI applications. When I say most common, they cover over 3,000 of the most popular UI apps out there in the primary tap (think repo). This might not sound like a lot in comparison to Apple’s app store, but unlike all the shoot-em-up games filling Apple’s coin-operated machine, it provides over 90% of the apps I use everyday. Check out my own script at the bottom of this post – I’ll bet you use lots of the same tools.
Hate the CLI?
Okay, so as I’ll show you, both Homebrew and Cask are as pimpsicle to use as “brew install foo” and “brew cask install bar“, but how about UI options here for the heathens among you. Yes, the irony of recommending a CLI tool to install a bunch of GUI tools is not lost on me. This is about using the best tool to automate something inherently repeatably (and dull).
I did hunt around for something, and I found two potential tools that seem to work in a very similar to the awesome Windows ninite tool.
I haven’t used either as the coverage wasn’t anywhere near that of Cask, but both look easy ways to install a handful of the more common apps out there. It might just scratch your itch sufficiently.
Here be Dragons!
So, you’ve thrown caution to the wind and decided to follow me on the journey into the murky CLI option. Here goes nothing.
Setup Homebrew
To get started, we use the only scary looking command in this post. Promise. Open a Terminal window and paste this in:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Don’t fret over what it means or does. Just do it, forget it, and move on with your life. Now comes the fun stuff.
Using Homebrew
Brew is super easy, with only a handful of commands that you’ll actually use. There is a man page, but you can probably see all you need by just typing:
brew
Here’s my top pick of commands, and probably the only ones you’ll need:
First, run the doctor command to do a health check of the install:
brew doctor
Let’s search for a tool to see what’s available and the package name used:
brew search top
The results of this command lists several different top-style commands such as dnstop, iftop, apachetop.
I find two versions of htop (htop and htop-osx) and I’m not quite sure which to go for, so I look at the info page for each with:
brew info htop-osx
and brew info htop
From that, I can see htop-osx is a much older legacy version.
To install htop I simply use:
brew install htop
Simple.
To remove it I’d just need:
brew uninstall htop
(BTW, don’t uninstall htop. It’s awesome)
There’s probably only a couple more commands I use that often:
– To update brew itself: brew update
– To upgrade all the apps: brew upgrade
(you can specify specific apps if you want to)
Two more that are worth taking a look at are:
– brew tap
to manage additional repositories
– brew cleanup
which removes the cached install files. The doctor
command shows how much space can be freed up by this.
To get a full listing of all the current brew formulaes available, do something like this:
brew list > brew_listing.txt
Setup Cask
Now we get to those GUI applications that our trackpad loves so much. Setting up casks these days is as easy as:
brew install cask
That’s it.
Using Cask
If you read the section on using brew, then you know how to use cask. Cask is implemented as a subcommand of Homebrew, just insert cask after the brew command. For example, to install the very handy cheetsheet tool:
brew cask install cheatsheet
(A great little app to help you learn all the keyboard shortcuts you ever wanted: http://lifehacker.com/5912990/cheatsheet-instantly-displays-all-the-keyboard-shortcuts-for-mac-apps)
Just like brew itself, run brew cask
to see a list of the main cask commands.
To get a full listing of all the current apps available from the default cask tap, do something like this:
brew cask list > cask_listing.txt
But where’s my new applications?
By default cask installs all its apps into directories under /opt and creates symlinks to your ~/Applications folder (in your own home directory, under /Users). If you want them in /Applications for easier access, just drag and drop the shortcuts across there yourself.
I tend to use Alfred to launch applications when I’m keeping my hands on the keyboard, so this isn’t a big deal for me as my good man finds the apps there without adjusting his bowler.
Alternatively, it seems you can add a line to your .bash_profile file. See here for the instructions: https://github.com/caskroom/homebrew-cask/blob/master/USAGE.md, but I suspect you’ll need to run some commands with elevated privileges – YMMV.
My own script
Below is the simple shell script that I’ll use next week to install my app list. I’m dropping it here for my own reference as much as anything, but I thought some of you might find it a useful starting point for your own use. I suspect that if you’ve followed the post this far you’ve probably share many of the poor tastes in applications as I do.
[bash]
#!/bin/bash
#
# Check that Homebrew is installed and install if not,
if test ! $(which brew); then
echo "Installing homebrew…"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Update any existing homebrew recipes
brew update
# Install my brew packages
brew install wget
brew install fish
brew install git
brew install htop
brew install calc
brew install tree
brew install ncdu
brew install irssi
# Install cask!
brew install cask
# Add tab completion for bash and fish to cask commands
brew install homebrew/completions/brew-cask-completion
# Install my cask packages
brew cask install abricotine
brew cask install adobe-reader
brew cask install airdroid
brew cask install alfred
brew cask install android-file-transfer
brew cask install angry-ip-scanner
brew cask install atom
brew cask install banshee
brew cask install boot2docker
brew cask install caffeine
brew cask install cakebrew
brew cask install calibre
brew cask install cheatsheet
brew cask install cpumeter
brew cask install day-o
brew cask install dockertoolbox
brew cask install dropbox
brew cask install evernote
brew cask install filezilla
brew cask install firefox
brew cask install flux
brew cask install git
brew cask install gitbook-editor
brew cask install github-desktop
brew cask install gmail-notifr
brew cask install google-chrome
brew cask install google-hangouts
brew cask install gpodder
brew cask install grandperspective
brew cask install iterm2
brew cask install keepassx
# brew cask install libreoffice
# brew cask install microsoft-intellipoint
# brew cask install microsoft-intellitype
# brew cask install microsoft-lync # Lync 2011
# brew cask install microsoft-lync-plugin
# brew cask install microsoft-office # Office 2016 installer
brew cask install movelinks
brew cask install pencil
brew cask install pomodone
brew cask install prey
brew cask install royal-tsx
brew cask install skim
brew cask install simplifyextras # Spotify mac keyboard control
# brew cask install skype
brew cask install slack
brew cask install spotifree
brew cask install spotify
brew cask install spotify-notifications
brew cask install teamviewer
brew cask install the-unarchiver
brew cask install transmission
brew cask install visual-studio-code
brew cask install vlc
brew cask install vmware-appcatalyst
brew cask install vmware-fusion
brew cask install vmware-horizon-client
brew cask install wireshark
brew cask install xmind
# Add other things from the beta "versions" tap
brew tap caskroom/versions
brew cask install google-chrome-canary
# Remove brew cruft
brew cleanup
# Remove cask cruft
brew cask cleanup
# Link alfred to apps
brew cask alfred link
[/bash]
Remember to make it executable: chmod a+x cask_installer.sh
Other tools I install
As a reminder to myself, here’s a list of the other apps that I install that unfortunately aren’t available via brew or cask:
1. FreeSpace Tab (App store)
2. Lightshot Screenshot (App store)
3. Memory Monitor
4. Microsoft Remote Desktop (App store)
5. Pocket (App store)
6. Pomodoro Time
7. ReadKit (App store)
8. Simplenote (App store)
9. TweetDeck (App store)
10. VMware Client Integration Plug-in
11. VMware Remote Console (VMRC 8.01) https://my.vmware.com/web/vmware/details?downloadGroup=VMRC801&productId=491
I can probably find replacements for some of these utility apps, i.e. # 1, 2, 3, 4, 6, 9 – suggestions in the comments section are most welcome!
Bonus: Cakebrew
One last thing I found while writing this article is something called cakebrew which provides a nice little GUI tool to install brew apps.
Unfortunately it doesn’t seem to support cask (GUI) apps yet. Yeah, there’s a very weird snake eating itself there – a GUI app to install CLI tools. Installed via the CLI: brew cask install cakebrew
. The feature request ticket for adding cask is here.
What’s your must have OS X apps?
What are your must-have applications for when you set up your MacBook? Let us know in the comments.
This is terrific, well written and easy to follow. Thanks!
A couple of questions:
– Do you know the difference between `brew cask` and `brew install cask`?
– Is a way to save and automatically apply all your preferences for the apps installed via `cask`?
Hi skube,
1) `brew cask` is the cask command. Normally you’d include additional commands to make it do something, such as `brew cask list` or `brew cask search`, but if you run `brew cask` by itself it will list out the next level of commands available.
`brew install cask` is a brew command which installs the cask command set and allows you to install cask applications.
2) Not that I know of. Cask is just a quick way of installing the apps, not to configure them (or save the configurations).
Thanks for the kind words, glad you liked the content.
Forbes
Thanks! It’s still a little confusing…
The Cask site says to install cask by doing `brew tap caskroom/cask` though `brew install cask` seems to make more sense.