brew - zollak/pentest-notes GitHub Wiki

Running brew list will show a list of all your installed Homebrew packages.

$ brew list

$ brew list | grep python
python
[email protected]

In addition, brew cask list will provide the items installed using Homebrew Cask.

$ brew cask list
android-sdk            java8                  jd-gui                 osxfuse                sublime-text           wkhtmltopdf

However, various required packages (dependencies) get automatically installed when installing a package using Homebrew. It is possible to view the list of all the installed packages as a nicely formatted dependency tree. To view it, execute the following command:

$ brew deps --tree --installed

$ brew deps --tree [email protected]
[email protected]
β”œβ”€β”€ gdbm
β”œβ”€β”€ [email protected]
β”œβ”€β”€ readline
β”œβ”€β”€ sqlite
β”‚   └── readline
└── xz

Managing Dependencies when Uninstalling Homebrew Packages

One thing to be mindful of when removing and uninstalling packages from Homebrew is that if the package being uninstalled has dependencies that are in use by another package or formula, then that may break it causing the secondary package to no longer work correctly. Perhaps the simplest way to prevent that is to use the optional –ignore-dependencies flag. For example:

$ brew uninstall --ignore-dependencies [email protected]
Uninstalling /usr/local/Cellar/[email protected]/3.8.2... (8,826 files, 124.6MB)

$ brew uninstall --ignore-dependencies python
Uninstalling /usr/local/Cellar/python/3.7.7... (8,615 files, 120.7MB)

Uninstall these versions of python (brew installed) not modified the MacOS defaults and the other versions (e.g. installed in package from python.org).

Uninstall android-sdk from cask repo:

MacBook-Pro:~ zollak$ brew cask uninstall android-sdk
==> Uninstalling Cask android-sdk
==> Unlinking Binary '/usr/local/bin/android'.
==> Unlinking Binary '/usr/local/bin/archquery'.
==> Unlinking Binary '/usr/local/bin/avdmanager'.
==> Unlinking Binary '/usr/local/bin/jobb'.
==> Unlinking Binary '/usr/local/bin/lint'.
==> Unlinking Binary '/usr/local/bin/monkeyrunner'.
==> Unlinking Binary '/usr/local/bin/screenshot2'.
==> Unlinking Binary '/usr/local/bin/sdkmanager'.
==> Unlinking Binary '/usr/local/bin/uiautomatorviewer'.
==> Unlinking Binary '/usr/local/bin/mksdcard'.
==> Unlinking Binary '/usr/local/bin/monitor'.
==> Purging files for version 3859397 of Cask android-sdk
⚠️ **GitHub.com Fallback** ⚠️