Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

homebrew and linuxbrew formula Notes

Chris Jones edited this page Sep 23, 2018 · 48 revisions

Contents

General homebrew brew & cask usage

Homebrew / Linuxbrew provides analytics for monitoring Homebrew usage out of the box

To status if Homebrew analytics is enabled

brew analytics

To disable Homebrew Linuxbrew analytics

brew analytics off

To remove soure tarballs and downloaded .DMGs for homebrew and cask

brew cleanup
brew cask cleanup

...will remove downloaded tarballs and image files stored within the below directory on macOS.

$HOME/Library/Caches/Homebrew

To print the location / directory where homebrew is storing tarballs for downloaded / installed apps.

brew --cache

The above command should print the output of the location of the tarballs, ie.

/home/$USER/.cache/Homebrew

To show outdated formula for homebrew

brew outdated
brew cask outdated --greedy

A lot of formula installed with cask update themeselves, but can also be updated with the --greedy flag.

brew cask upgrade --greedy

To print a list of taps sourced for homebrew usage

brew tap

To print a pretty πŸ’‹ list of installed Homebrew formula and their dependencies in a graphical format

brew deps --tree --installed

To (re)compile a program from source, ie. Vim

brew -v reinstall --build-from-source vim

More information for working with taps

Installing Homebrew Linuxbrew

Installing Linuxbrew on a Raspberry Pi running Raspbian

Generating a list of installed packages, ie. formula and casks

brew bundle

To overwrite an existing Brewfile

brew bundle --force dump

Homebrew-Cask Installation

To install Homebrew-Cask via Homebrew

brew tap caskroom/cask

Homebrew-Cask has recently been migrated to the Homebrew umbrella on github, ie. Homebrew/homebrew-cask whereas the "main" formula are located at Homebrew/homebrew-core on github.

Homebrew-Cask Versions Installation

To install the above mentioned repo

brew tap caskroom/versions

To install a cask from caskroom/versions/hyper-canary

brew cask install hyper-canary

To setup a mulit user brew environment on macOS

  1. Determine the path of the brew prefix, ie. the path that will be used to store files related to working with homebrew
  2. Check that all users on the system who need access to brew are in the admin group
  3. Optional Add a user to the admin group if a user needs access to brew

Will require access / privileges to use the sudo command

  1. Set the brew prefix path to be recursively owned by the admin group
  2. Set the brew prefix path to be recursively writable by all users who are in the admin group
  3. Verify the permissions of the brew prefix
  4. brew

echo $(brew --prefix)
echo $(groups whoami)
sudo dseditgroup -o edit -a $(whoami) -t user admin
sudo chgrp -R admin $(brew --prefix) 
sudo chmod -R g+w $(brew --prefix)
ls -lah $(brew --prefix)

Working with Pythons - 2.x 3.x

Initial Setup

After installing python via homebrew and is properly configured in the PATH

python -m pip install --upgrade setuptools
python -m pip install --upgrade pip

⚠️ When using the --user flag with pip on macOS packages, ie. virtualenv will be placed in `$HOME/Library/Python/[major.minor]/bin/

Homebrew can install concurrent Pythons on the local system.

Homebrew seperates its pythons by creating seperate binaries, ie. python 2.x is located at

/usr/local/opt/python/libexec/bin/python

and python 3.x is located at

/usr/local/bin/python3

Both pythons use seperate pip packagemanagers to manage python dependencies, ie. python 2.x uses

/usr/local/opt/python/libexec/bin/pip

and python 3.x uses

/usr/local/bin/pip3

Python Useful Links

Homebrew documentation - Python

Build time options / parameters

To show build time options for a homebrew formula

brew info [mr_fancy_pants_formula]

brew info weechat

Working with homebrew casks

To search for a brew formula from a cask, ie. kodi

brew search kodi

Output:

brew search kodi 0 < 14:24:28
==> Searching local taps...
==> Searching taps on GitHub...
caskroom/cask/kodi caskroom/versions/kodi-development
==> Searching blacklisted, migrated and deleted formulae...

Then to install kodi

brew cask install kodi

To edit a formula, make sure the $EDITOR environment variable is set to your favorite text editor, ie. in the fish shell,

set -x EDITOR /path/to/your/favorite/editor

Example

set -x EDITOR /home/linuxbrew/.linuxbrew/bin/nvim

Then one can edit the formula of choosing with the below command,

brew edit <name_of_formula.rb>

Example

brew edit weechat.rb

To list all installed packages with homebrew 🍻

brew list
brew cask list

To get the SHA 256 hash of a file

shasum -a 256 <name_of_file> | awk '{printf 1ドル}' | pbcopy

Working with Homebrew / Linuxbrew formula

Useful Links πŸ”—

TODOs

  • add entries to table of contents for this .md file
  • figure out which binaries belong to which packages, ie. which package installed locate

Frequent Flyers ✈️

❀️ ~/.πŸ› πŸˆ

Clone this wiki locally

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /