If you are familiar with the command line then, package management is likely not new to you. However, when I first started out using the terminal, I didn’t have a clue what it was. I had read that a lot of people were using something called homebrew. So, I installed it not really knowing how it worked or even what it did. Just copy and paste this code from the internet and push enter. Streams of funny looking characters were appearing on my computer screen. What did I just do? Is someone hacking me? Did I just give some hacker full control over my computer? Should I do a hard restart? By the time I finished panicking I had a message saying the homebrew had been installed.
I’ve come a long way since then. I now rely on homebrew to install the majority of my command line tools and even my apps. It is super simple to use. But before we get into how to use it, let’s install it. One thing to note before we go any further is that homebrew is for Mac only. If you are using Linux you have plenty of other options which we can go over in another post. If you are using windows switch to Mac or Linux! Just kidding but seriously you are missing out on some cool command line stuff.
- Open up a terminal. You can find this by looking for it in your applications folder or alternatively use spotlight (keyboard shortcut is ⌘ + spacebar) and typing terminal. Terminal is built into Mac by default.
- Go to the Homebrew Website and copy the code provided under the install homebrew header.
- Head back to the terminal and paste in the copied code (Keyboard Shortcut for paste is ⌘ + v).
- Press enter and watch the magic happen as homebrew will now install itself. Don’t panic and restart your computer though!
You now have entered the world of package management. Let’s install something.
Installing Command Line Tools
There are a ton of command line tools out there. Most are useful, some are just fun. Here is a couple to try installing.
- ImageMagick – For manipulating images via the command line
- Cowsay – An text animation of a cow with a quote because why not!
- Archey – Gives you a rundown of your mac
- Python3 – If you want to write in python you are going to need this installed.
- Curl – This makes it easy to download from a URL
- Git – This is the most popular version control programme around
- Htop – Keep track of the process running on your computer
Now to install any of these is simple. In terminal type “brew install” followed by the name of the tool you want.
brew install cowsay
brew install python3
You get the point. It’s just as easy to uninstall using homebrew. Just replace the word install with uninstall.
brew uninstall cowsay
brew uninstall python3
Can’t remember what you installed. Just type
brew list You can even search for tools. Just type brew search followed by the name of the tool you are after.
You will get a list of everything you have installed using homebrew. If you want to see what else you can do with homebrew, just type brew help.
How to install mac apps with homebrew
Here is my absolute favourite part of homebrew. Installing mac apps and deleting them is pretty easy but it is even easier with homebrew cask. First, we are going to need to install homebrew cast. Just type the following code:
brew tap caskroom/cask
Next, think of an app you want. While you won’t find everything you are looking for, most popular apps are there.
Let’s take the app Hazel for example. Hazel is a great tool for keeping everything on your mac organized. First, let’s run a search.
brew cask search hazel
As you can see we got an exact match, meaning it can be installed.
To install we just type
brew cask install hazel
It will now go about downloading and installing Hazel to your mac. Go have a look in your applications folder. You should see a copy of Hazel.
To uninstall just replace install with uninstall.
You can easily update your command line tools and apps with homebrew.
For the command line tools
brew cask upgrade
I hope I have started the process of converting you to a homebrew user. Let me know in the comments below how you get on or if you have any homebrew tips.