💾 Archived View for notes.nicfab.eu › en › gemlogen › 2023 › 2023-01-16-homebrew_en.gmi captured on 2023-09-08 at 16:05:16. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-03-20)

🚧 View Differences

-=-=-=-=-=-=-

2023-01-16 - Homebrew: the simple but powerful package manager

Homebrew

Homebrew is well known and should be considered a "must have", so much so that we have already mentioned it several times on this digital notebook but only incidentally to describe some commands.

Homebrew is an open-source package manager written in Ruby (on

GitHub) that allows the installation of packages missing from Apple's operating system (or Linux).

Install Homebrew

Homebrew installation is described on the

official site home page, and run it by launching the Terminal app and typing the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

As indicated on the

page about installing Homebrew, you may need to install

Xcode, or Command Line Tools (CLT) for Xcode via the command from the Terminal

xcode-select --install

The installation path changes depending on the processor that is on the Apple machine specifically:

/usr/local
/opt/homebrew

On Silicon Macs, an additional step is required because the

folder is not part of the default 

Therefore, the following message should be present at the end of the installation.

- Add Homebrew to your PATH in ~/.zprofile:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Therefore, it will be sufficient to open the Terminal app and type the following command:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

That will add the string

eval "$(/opt/homebrew/bin/brew shellenv)"

to the file

~/.zprofile

To verify that this was successful, from the Terminal app, you can open the file

.zprofile

with an editor as in the following command:

nano ~/.zprofile

If everything was successful, you would see the string

eval "$(/opt/homebrew/bin/brew shellenv)"

If you want to verify the correct installation of Homebrew, you can type the following command from the Terminal app:

brew doctor

If everything was successful, you would see the following message

Your system is ready to brew.

Tip for Analytics

As

stated on the official website

Homebrew gathers anonymous aggregate user behaviour analytics using Google Analytics.

Therefore, after installation, we suggest disabling "Analytics" using the following command:

brew analytics off

You can verify by the following command:

brew analytics state

And you will see the following message:

Analytics are disabled.

Below is the video that plays the installation of Homebrew and the execution of some commands described so far.

https://asciinema.org/a/gg5ex55kRNQRb6lHTCxk7A1Du.js

Install packages

Once Homebrew has been installed, when it wants to install a package, simply launch the Terminal app and type

brew install <nomepacchetto>

To find out which packages have been installed, run the following command

brew list

Sometimes installed packages have so-called "dependencies" (basically other packages needed for proper functioning the application you install). With the following command, you can see all the installed packages and their dependencies:

brew deps --tree --installed

If you want to see the dependencies of a specific installation, you will have to type the following command

brew deps --tree --installed <nomepacchetto>

The commands we prefer

There are some commands that need to be used most frequently, and it takes work to remember them along with any parameters. Therefore, our selection aims to indicate those commands we usually use most frequently.

brew update
brew upgrade
brew update && brew upgrade
brew remove <nomepacchetto>
brew outdated
brew autoremove
brew cleanup -s

To make sure that all packages have been removed, you can run the following command (the `--dry-run` option does not perform the deletion but only shows what will be deleted)

brew cleanup --prune=all --dry-run

With the following command, you will have the actual elimination

brew cleanup --prune=all
brew install <nomeapp> --cask

brew remove <nomeapp> --cask

We use another powerful resource which is

Texexpander, and all the commands indicated can also be defined as "snippets" and called up by typing the label we have assigned.

If this resource was helpful, you could contribute by

Buy me a coffee

Or donate via

Liberapay

Follow us on

Mastodon

Stay tuned!