macOS, quick tutorial of Homebrew

in #technology6 years ago (edited)

Let’s see some things about Brew or Homebrew, a macOS useful tool. What is that? Brew is a repository software, or package manager, mostly Open Source where to download, install and maintain updates simple and easy.

I some way can be considered like App Store, but without a graphic interface, in fact all happens to the command line. For those came from Ubuntu or Debian will found this very friendly because the system is nearly identical.

presentation-1794128_1280.png
picture CC0 creative commons

I know, command line, terminal, things to write… is not Apple fancy, but if you are a little bit a programmer or nerd you gonna love it.

Let’s start. First we need to install the whole system. To the page at https://brew.sh you find the line to copy and paste on command line.

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

the process may can ask a root password (or the password you enter for the system) is safe, Brew is widely know and open source. You can trust it. After the process we have some new commands.

We can make an easy and useful example, like install Node.js on your system. In the “normal” way you have to go to the page of Node, download, open the DMG, install. Not hard, but when you have to update the software, and Node updates often times a month, you have to repeat every time the steps above.

With brew is a piece of cake because install require three words:

brew install node@8

That’s it, the system called “formulae” contact the server, check the dependencies an install it. After that you can check and update Node and other software installed by brew with another simple line:

brew update && brew upgrade

Again, simple and smooth.

How to search software in Brew?
Simple, let’s search for example docker:

brew search docker

You will see a long list, because the word “docker” is show inside many other words, like docker-compose and so on. If you see a green check beside the word means the software is already installed on your system.

This can be interesting, how know about things installed on my computer. Maybe after a long time of utilisation you may forget what you have installed. Again with a simple word:

brew list

This can be a little bit confusing, because the list can be more long than expected. In fact Brew install all the dependencies needed for the software request. If you install Docker, the same need to install docker-compoer, docker-machine and so on, because he needed for works without errors. Brew don’t ask a permission for those software and libraries, this can be reflected on list command.
But don’t be afraid, we can also show a list of software installed and we have requested in two ways:

brew leaves

This command show all the formulae installed not a dependencies of other one, so this are the software requested. Another fancy view can be called with:

brew deps --installed --tree

The list now can show the formulae installed and the dependencies in a tree way.
Ok we have see how to search, how to install, how to update… but how to uninstall?

brew uninstall docker

This remove docker and all software related to this dependencies’ if not used by another software.
There are lot of commands to know and understand, but these are the most important for start and dive into this little world. With the command:

man brew

You can read the manual and what every option do (press key Q for exit from “man” mode).

In conclusion, if you have a Mac you definitely need Homebrew installed on your system. As you can see this make simple lot of things like install and in top of that, update and maintain your software update and fresh.

Hope this little "tut" can help you :-)

For italian audience, you can find the article here.

Coin Marketplace

STEEM 0.19
TRX 0.15
JST 0.029
BTC 63626.66
ETH 2640.26
USDT 1.00
SBD 2.75