Some formulae inhomebrew/core
are made available asversioned formulae using a special naming format, e.g.gcc@9
. If the version you’re looking for isn’t available, consider usingbrew extract
.
brewunlink <formula>
This can be useful if a package can’t build against the version of something you have linked into Homebrew’s prefix.
And of course, you can simplybrew link <formula>
again afterwards!
Sometimes it’s faster to download a file via means other than the strategies that are available as part of Homebrew. For example, Erlang provides a torrent that’ll let you download at 4–5× compared to the normal HTTP method.
Downloads are saved in thedownloads
subdirectory of Homebrew’s cache directory (as specified bybrew --cache
, e.g.~/Library/Caches/Homebrew
) and renamed as<url-hash>--<formula>-<version>
. The commandbrew --cache --build-from-source <formula>
will print the expected path of the cached download, so after downloading the file, you can runmv the_tarball "$(brew --cache --build-from-source <formula>)"
to relocate it to the cache.
You can also pre-cache the download by using the commandbrew fetch <formula>
which also displays the SHA-256 hash. This can be useful for updating formulae to new versions.
brew sh# or: eval "$(brew --env)"geminstallronn# or c-programs
This imports thebrew
environment into your existing shell;gem
will pick up the environment variables and be able to build. As a bonus,brew
’s automatically determined optimization flags are set.
brewinstall--only-dependencies <formula>
$brew irb==>Interactive Homebrew ShellExample commands available with: `brew irb --examples`irb(main):001:0>Formulary.factory("ace").methods - Object.methods=>[:install, :test, :test_defined?, :sbin, :pkgshare, :elisp,:frameworks, :kext_prefix, :any_version_installed?, :etc, :pkgetc,...:on_macos, :on_linux, :debug?, :quiet?, :verbose?, :with_context]irb(main):002:0>
exportHOMEBREW_NO_EMOJI=1
This sets theHOMEBREW_NO_EMOJI
environment variable, causing Homebrew to hide all emoji.
The beer emoji can also be replaced with other character(s):
exportHOMEBREW_INSTALL_BADGE="☕️ 🐸"
Runningbrew bundle dump
will record an installation to aBrewfile
andbrew bundle install
will install from aBrewfile
. Seebrew bundle --help
for more details.
Runbrew install --cask
with the--adopt
switch:
$brewinstall--cask--adopt textmate==>Downloading https://github.com/textmate/textmate/releases/download/v2.0.23/TextMate_2.0.23.tbz...==>Installing Cask textmate==>Adopting existing App at'/Applications/TextMate.app'==>Linking Binary'mate' to'/opt/homebrew/bin/mate'🍺 textmate was successfully installed!
Brewfile adds Ruby syntax highlighting forbrew bundle
’sBrewfile
s.
Brew Services is an extension for starting and stopping Homebrew services.
homebrew-mode provides syntax highlighting for inline patches as well as a number of helper functions for editing formula files.
pcmpl-homebrew provides completion for emacs shell-mode and eshell-mode.
In the macOS Terminal, you can right-click on a command name (likels
ortar
) and pop open its manpage in a new window by selecting “Open man Page”.
Terminal needs an extra hint on where to find manpages installed by Homebrew because it doesn’t load normal dotfiles like~/.bash_profile
or~/.zshrc
.
sudo mkdir-p /usr/local/etc/man.decho"MANPATH /opt/homebrew/share/man" |sudo tee-a /usr/local/etc/man.d/homebrew.man.conf
If you’re using Homebrew on macOS Intel, you should also fix permissions afterwards with:
sudo chown-R"${USER}" /usr/local/etc
You can configure Homebrew to retrieve bottles from a caching proxy or mirror.
For example, in JFrog’s Artifactory, accessible athttps://artifacts.example.com
,configure a new “remote” repository withhomebrew
as the “repository key” andhttps://ghcr.io
as the URL.
Then, set these environment variables for Homebrew to retrieve from the caching proxy.
exportHOMEBREW_ARTIFACT_DOMAIN=https://artifacts.example.com/artifactory/homebrew/exportHOMEBREW_ARTIFACT_DOMAIN_NO_FALLBACK=1exportHOMEBREW_DOCKER_REGISTRY_BASIC_AUTH_TOKEN="$(printf'anonymous:' |base64)"
Some users may want to use the same shell initialization files on macOS and Linux.Use this to detect the likely Homebrew installation directory and load Homebrew when it’s found.You may need to adapt this to your particular shell or other particulars of your environment.
command-v brew||exportPATH="/opt/homebrew/bin:/home/linuxbrew/.linuxbrew/bin:/usr/local/bin"command-v brew&&eval"$(brew shellenv)"