Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
Installation¶
macOS¶
By default,
Homebrew is installed to the location /opt/homebrew.
You can add the command brew into $PATH
by adding the following configuration into your shell configuration
(e.g., .bashrc for bash)
.
:::bash
eval "$(/opt/homebrew/bin/brew shellenv)"Linux¶
https://
sh -c "$(curl --proxy http://your.proxy.servder:port -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"The installation script installs Homebrew to /home/linuxbrew/.linuxbrew using sudo if possible and in your home directory at ~/.linuxbrew otherwise. Homebrew does not use sudo after installation. Using /home/linuxbrew/.linuxbrew allows the use of more binary packages (bottles) than installing in your personal home directory.
Follow the instructions below if you have to install Linuxbrew using a proxy.
Configure the environment variables
http_proxyandhttps_proxy.export http_proxy=http://your.proxy.server:port export https_proxy=http://your.proxy.server:portConfigure proxy for Git (as Linuxbrew rely on Git to work) following instructions in Use Git Behind a Proxy.
You can export environment variables for Linuxbrew using the following command
assuming Linuxbrew is installed to /home/linuxbrew/.linuxbrew.
/home/linuxbrew/.linuxbrew/bin/brew shellenv >> .bash_profileOr use the following command if Linuxbrew is installed to ~/.linuxbrew.
~/.linuxbrew/bin/brew shellenv >> .bash_profileTips and Traps¶
All Homebrew formulas are listed at https://
formulae .brew .sh /formula/. You can search on the site for available formulas. Linuxbrew/brew has been merged into Homebrew/brew. For more please refer to this issue. Linuxbrew is a good tool to install Linux packages in environments which you do not have sudo permission.
You might encounter link problems when you use the
brewcommand to install packages on Mac. A possible way to fix the issue is to manually configure thePATHenvironemnt variable. Or a quick and dirty way to resolve the problem is to link the executable file into$HOME/bin.You can install a specific version of a package using the
@symbol. For example, the command below installs node 8.brew install node@8All available versions of a package (say, node) can be listed using the following command.
brew search node@If there are multiple version of a package (say, node) installed, you can set the default version of the package to use using the command below.
brew switch node 10.15.0Uninstall a package, say,
telnet.brew uninstall telnet # or brew remove telnetDo not install python using brew as you will end up with 2 copies of python
better to use MacVim instead of Vim.
brew install macvimThe command for MacVim is
mvim. For convenience, you can link it to$HOME/bin/vim.No readlink on Mac. Use
greadlinkinstead. You have install the packagecoreutilsin order to usegreadlink.brew install coreutils
Example Commands¶
brew install
brew uninstall
brew link
brew unlink
brew search
brew list
brew list | xargs brew uninstall
brew search python@3.6
brew ls --versions nodeInstall gcc/g++.
:::bash brew install gccInstall LLVM and clang.
:::bash brew install llvm
References¶
Why linking keg-only formulae requires –force option in homebrew?
https://
https://
http://