Brew and Cask, the package manager(s) for every MacOSX user #macosx #newbies

Share on:

This post is not targeting people who already consider themselves MacOSX powerusers or they already are users of brew and cask.

I have to admit, I discovered the power and easiness of these tools, quite late in my MacOSX user life, so I have to thank my ex-colleague and friend Harris who forced me to integrate brew and brew cask to my daily routine as user.

What is brew and brew cask?

Eventually they are command line tools (no don't go away, if you don't feel very comfortable, it is really going to pay up), that can take care the installation of several tools, apps or libraries in your mac. Tools like that, usually go after the name package managers or installers. Linux power users are accustomed to 'apt-get' or 'yumor lately 'dnf'. So the end result is something like, you open the Terminal.app and you type

brew install brew cask install

The in the examples above are the library or application you wish to install on your mac. The tools download and install accordingly whatever is supported (meaning listed on their _dictionary of registered apps' and you are done.

How do I install them?

Make note that these tools are interconnected, meaning that you need to install brew and then cask which is actually an extension of brew. Let's get started

You need to have git installed

Power users might already have git installed, it comes along with the developer tool XCode. So one way on having git installed in your Mac is to install XCode. An alternative is to install the OSX command line tools (search Command line tools OSX). In order to check if you are ok after installing the tool is to open the Terminal.app and type

git --version

It should return something like git version 2.x

Install HomeBrew aka (brew)

Very easy, as you can see in their site, it is just one command, open your Terminal.all and type,

1ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

After some seconds you are done, when it is finished I just you type

brew doctor & brew update

Install Caskroom aka (cask)

Once you have brew installed and running, you add cask. It is very simple. Just open again your Terminal.app and type

_brew install caskroom/cask/brew-cask'

Eventually this your first installation using brew, if you remember cask is just another supported program so with the command above we have just used brew to install _cask'. After some seconds you are ready! Both of the tools are ready for use.

How do I install something?

Remember that you usually use brew to install command line tools and cask for GUI apps. So let's see some examples

Search for an app to install e.g. firefox, you type in the Terminal.app

brew cask search firefox

The application is going to respond that it found a match for your search or provide similar results

==> Exact match firefox ==> Partial matches multifirefox

In order to install firefox you type

brew cask install firefox

This is it, firefox is going to be downloaded and is going to be place in the following folder,

_/opt/homebrew-cask/Caskroom/libreoffice'

Some of the installers they usually put a shortcut (link) to the /Applications folder, where we usually keep all our apps. Some don,t, for that reason I have in finder a shortcut to the Caskroom folder. See the image below.

How do I uninstall something?

You just type something like the following, we want to uninstall firefox.

brew cask uninstall firefox

How do I search for something?

In order to check if brew or brew cask knows how to install something for you (since it does not support everything) you need to search it . You can type something like the following.

brew cask search libreoffice

How do I update something?

Currently in order to upgrade something with cask you just need to install it's new version, but you might ask how do I know about the new version? So usually what you need to do, is to instruct cask to update it's list of recipes (apps), most probably members of the community will have added a new recipe for your program. So you just need to type

brew cask update

brew update

Cask or brew will then you receive the updated list, in case there is a new version of firefox you can do the following

brew cask install firefox --force

Note: For libraries or applications installed with brew, there is an easier way, just type

brew upgrade theApp

And brew will upgrade the current installation. Remember cask is usually for installing gui based apps where brew is for command line tools.

How do I check the details of an installed app?

You can just type :

brew cask info anAppName

or

brew info anAppName

How do I find all the available commands of both tools?

You type:

brew cask help

or

brew help

So, I hope that helps. I have been happily using brew and brew cask for almost 1.5 years and I have to admit, I should have embraced them earlier as a macosx user. It would have saved me a lot of time.

It might feel a bit weird, especially for users that are not used of the Terminal, but it is really worth your time. For power users or developers working on MacOSX it is really a must.

If you want to check out my setup, I have a simple bash script that uses brew and cask to setup my favorite apps. You can find it here.

brew and brew cask everything!