Basic Tools – Brew

🗓 Previously on Mac2net – I reviewed several tools to help get started on the path to self hosting

Login to the remote Mac

The first time you use SSH to login to another machine you will be asked to approve a key fingerprint.


$ssh user@192.168.x.x              
The authenticity of host '192.168.x.x (192.168.x.x)' can't be established.
ED25519 key fingerprint is [key is here].
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.x.x' (ED25519) to the list of known hosts.
(user@192.168.x.x) Password:


If in the future the remote Mac‘s IP address changes (for example if the DHCP lease has expired and the router has assigned a new IP address to the remote Mac), you will be asked to approve the key fingerprint again

Install Brew

In order to install Brew on the remote Mac via the terminal Installing Brew is easy. The current install command is at the bottom of the home page.


If you are using the default shell – zsh – consider adding a shell plugin manager. I use Antigen which is outdated and requires some changes inside its code to automatically download plugins. I looked at some other plugins when I was writing this, but frankly they all seem complex and remember for self-hosting the terminal is a tool, not a religion. Most terminal apps and ZSH managers have a long complex list of configurable parameters. When looking at them, it is easy to see why it difficult to figure out which of them is important and which are not.


Open your terminal app and paste the code below into the terminal window…


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


brew_home


Below is a copy of the output from the Brew install command on the remote Mac which has an Intel processor.


Please note: running Brew on a multi-user Mac is not straight forward See Google AI… The install location on a Mac with an Mx CPU is /opt/homebrew.


09-Oct 10:30 [user-machine]~$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The Xcode Command Line Tools will be installed.

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R [user]:admin /usr/local/Homebrew
==> Searching online for the Command Line Tools
==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Installing Command Line Tools for Xcode-16.4
==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command Line Tools for Xcode-16.4
Software Update Tool

Finding available software

Downloading Command Line Tools for Xcode
Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode

Done with Command Line Tools for Xcode
Done.
==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
Password:
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Downloading and installing Homebrew...
remote: Enumerating objects: 16308, done.
remote: Counting objects: 100% (6299/6299), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 16308 (delta 6267), reused 6219 (delta 6219), pack-reused 10009 (from 5)
==> Updating Homebrew...
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:0c78b38f22fb9b42df6918db00e6f5a80d5b35164f910ffe4c89159326ae98cf
################################################################### 100.0%
==> Pouring portable-ruby-3.4.5.el_capitan.bottle.tar.gz
Updated 2 taps (homebrew/core and homebrew/cask).
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations

==> Next steps:
- Run brew help to get started
- Further documentation: https://docs.brew.sh
09-Oct 10:40 [user-machine]~$

Brew Documentation

The documentation is more a TOC. Check the https://docs.brew.sh/Manpage link for details on Brew Commands.


brew-documentation

Basic Brew Commands

If you are lost in Brew, just do this…


$ brew
Example usage:
  brew search TEXT|/REGEX/
  brew info [FORMULA|CASK...]
  brew install FORMULA|CASK...
  brew update
  brew upgrade [FORMULA|CASK...]
  brew uninstall FORMULA|CASK...
  brew list [FORMULA|CASK...]

Troubleshooting:
  brew config
  brew doctor
  brew install --verbose --debug FORMULA|CASK

Contributing:
  brew create URL [--no-fetch]
  brew edit [FORMULA|CASK...]

Further help:
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

Other important Brew commands

# Get a list of  Brew commands
$ brew commands

# Get help
$ brew [command] -h

# Update Brew
$ brew update [-h]
Usage: brew update [options]

Fetch the newest version of Homebrew and all formulae from GitHub using git(1)
and perform any necessary migrations.

      --merge                      Use git merge to apply updates (rather than
                                   git rebase).
      --auto-update                Run on auto-updates (e.g. before brew
                                   install). Skips some slower steps.
  -f, --force                      Always do a slower, full update check (even
                                   if unnecessary).
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Print the directories checked and git
                                   operations performed.
  -d, --debug                      Display a trace of all shell commands as they
                                   are executed.
  -h, --help                       Show this message.

# Upgrade Brew packages
$ brew upgrade [-h]
Usage: brew upgrade [options] [outdated_formula|outdated_cask ...]

Upgrade outdated casks and outdated, unpinned formulae using the same options
they were originally installed with, plus any appended brew formula options. If
cask or formula are specified, upgrade only the given cask or formula
kegs (unless they are pinned; see pin, unpin).

Unless HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK is set, brew upgrade or brew
reinstall will be run for outdated dependents and dependents with broken
linkage, respectively.

Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the upgraded formulae or, every 30 days, for all formulae.
# Long list of options

# Install packages
$ brew install [-h]
[long list of commands]