Skip to content

macOS Homebrew

Commands

Command Note
brew update update homebrew
brew upgrade update apps installed via home-brew
brew tap [repo] opens a "tap" i.e. allows homebrew to
read another repository of formulae
e.g. brew tap josegonzalez/homebrew-php
brew cask zap zoomus remove a cask-installed app with all files
brew cask zap --force zoomus use --force to successfully
remove apps not installed via homebrew cask

1 HN comment on post below, specific to homebrew cask zap
2 HN Post on Zoom
3 HN Comment link
4 Posted on Rwtxt

Notes

Keg Only installations with Homebrew

For a software to be "keg-only" means it is installed in /usr/local/Cellar but not linked into places like /usr/local/bin, /usr/local/lib, etc. That means other software that depends on it has to be compiled with specific instructions to use the files in /usr/local/Cellar. That's done automatically by brew install when a formula specifies keg-only dependencies.
Formulas that specify keg-only dependencies make sure that the equivalent system libraries are not used. Your installation of vips is linked against a specific version of pixman in /usr/local/Cellar/pixman/version, so it isn't affected by the system version of pixman or any other Homebrew versions of pixman you might install.
REF - StackOverlflow post

Errors When Updating Casks

If this error occurs:
(In this example it happened with Enpass)

Error: Cask 'enpass' definition is invalid: invalid 'depends_on macos' value: ":mountain_lion"

run:

/usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g' 1

Errors/Issues After Updating Homebrew or macOS

Fix for Error - after update Homebrew was not found

HOMEBREW NOT WORKING AFTER UPDATE

Homebrew was not working and brew list, brew update, etc were not working.

First the owner of /usr/local/ was changed: sudo chown -R $USER:admin /usr/local

but it was not enough. Somehow it still gave an error. Then this helped: cd /usr/local git reset --hard origin/master

Running brew update and brew upgrade after the git reset command worked fine.

JUST TO BE SURE, RAN THE FOLLOWING:

  • fix homebrew stuff:
    brew update
    brew upgrade
    brew doctor

  • got warning that broken symlinks were found. so:
    brew prune

  • ran this just in case:
    brew linkapps

  • run again:
    brew upgrade
    brew update

  • run last item to fix homebrew:
    brew doctor

  • run cleanup at the end:
    brew cleanup
    # THIS CLEANED 4.4G OF DISK SPACE!

Fix After Homebrew Update to Verion 1.0.0

HOMEBREW UPDATE TO VERSION 1.0.0

REF hn comment

brew update
...
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local
...

brew doctor
warning: You have Xcode 8 installed without the CLT;
this causes certain builds to fail on OS X El Capitan (10.11).
Please install the CLT via:
sudo xcode-select --install

sudo xcode-select --install

brew doctor
Your system is ready to brew.

brew upgrade

brew linkapps macvim
Linking: /usr/local/opt/macvim/MacVim.app
Linked 1 app to /Applications

brew doctor
Your system is ready to brew.

brew cleanup

Python

pyenv

After updating pyenv the homebrew symlinks need to be updated, otherwise it will not find the python executable. For this run:

pyenv rehash

PHP

Manage Casks Using Cask Upgrade

  • GitHub link - Homebrew Cask Upgrade

  • To 'install' add the tap:
    brew tap buo/cask-upgrade

  • Upgrade outdated apps:
    brew cu

  • Upgrade a specific app:
    brew cu [CASK]

  • Notes on usage (from the GitHub readme):

    Apps with auto-update

    If the app has the auto update functionality (i.e. they ask you themselves if you want to upgrade them), they are not upgraded while running brew cu and will display a PASS result. If you want to upgrade them, pass the -a or --all option to include also those kind of apps.

    Please note, that if you update the apps using their auto-update functionality, that change will not reflect in the brew cu script! Tracked version gets only updated, when the app is upgraded through brew cu --all.

  • Upgrade cask apps which have auto-update brew cu -a

  • Display usage instructions:
    brew help cu

Note on Homebrew Casks Without Using Cask Upgrade

REF : - StackOverflow page - StackOverflow post with reply

There is now finally an official upgrade mechanism for Homebrew Cask (see Issue 3396 for the implementation)! To use it, simply run this command:

brew cask upgrade

However this will not update casks that do not have versioning information (version :latest) or applications that have a built-in upgrade mechanism (auto_updates true). To reinstall these casks (and consequently upgrade them if upgrades are available), run the upgrade command with the --greedy flag like this:

brew cask upgrade --greedy

Removing apps (even not installed with cask)

  • note from HN 3 :

    If you have Homebrew installed, you can run brew cask zap zoomus to get rid of all the things (as far as we know) Zoom has installed.

    If you prefer to remove it manually, here’s the list of files and folders Homebrew will delete on brew cask zap zoomus:

brew cask zap --force APPNAME

All Items I Have Installed

Currently Installed Command-Line Tools (output of brew list)

autoconf
bash
bash-completion
broot
ccat
gettext
ghostscript
git
jpeg
libtiff
ncurses
openssl
openssl@1.1
pandoc
pcre
pcre2
pkg-config
pyenv
pyenv-virtualenv
pyenv-virtualenvwrapper
readline
tree
xz
zlib
zsh
zsh-completions
zsh-syntax-highlighting

Currently Installed Apps (output of brew cask list)

alfred
appcleaner
atom
bartender
bettertouchtool
boostnote
brackets
brave-browser
ccleaner
cd-to-iterm
cheatsheet
day-o
default-folder-x
desktoputility
diskwave
dropbox
emacs-mac
enpass
epic
evernote
firefox-developer-edition
firefox-nightly
flux
font-anonymous-pro
font-fira-code
font-hack
font-source-code-pro
github
google-chrome
google-chrome-canary
hex-fiend
hyper
insync
iterm2
joplin
liya
lyx
macdown
mactex
mediainfo
namechanger
nvalt
standard-notes
sublime-text
texmaker
texts
the-unarchiver
tigervpn
typora
virtualbox
visual-studio-code
vivaldi
vlc
windscribe
wordpresscom