Similar to MacPorts, the package management tool under OS X is Homebrew and the installation method is simple.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
OK, the installation is complete, the use of Homebrew is also very simple.
Basic usage
- Brew Search Formula # Search Package
- Brew Install Formula # Install package
- Brew Remove Formula # Remove Package
- Brew Cleanup Formula # clear Old pack
- Brew List # Lists installed packages
- Brew Update # Update Homebrew
- Brew Upgrade # Upgrade Package
- Brew Home Formula # Open with browser
- Brew Info Formula # displays software content information
- Brew Deps Formula # Show dependencies for packages
- Brew Server # Launches a Web server that can be accessed through a browser http://localhost:4567 to manage packages through a Web page
- Brew-h # Help
- Brew Versions Formula # List the version of the package
The specific usage can be man brew
.
Brew Search Formula
The main point here is that brew search formula sometimes appears
Error: GitHub API rate limit exceeded for ip. See http://developer.github.com/v3/#rate-limiting for details. You may want to create an API token: http://github.com/settings/applications and then set HOMEBREW_GITHUB_API_TOKEN.
The hint is already clear, follow the instructions, register a GitHub account, open the page http://github.com/settings/applications. Click Create new token
, fill in token descrption, click Create token
~/.bash_profile
Add the tokens you have applied to your home directory as follows
if [ -f /usr/local/bin/brew ]; then export HOMEBREW_GITHUB_API_TOKEN=xxxxxxxxxxfi
Finally . ~/.bash_profile
, update your environment variables.
Multi-version Coexistence
Another, the skill of installing different versions of formula, such as installing different versions of Htop
$ brew Versions Htop # shows the historical version of Htop Warning:brew-versions is unsupported and could be removed SOON.P Lease use the homebrew-versions tap instead:https://github.com/homebrew/homebrew-versions 0.8.2.2 git checkout 43b7f5b LIBRARY/FORMULA/HTOP-OSX.RB 0.8.2.1 git checkout 8e24412 library/formula/htop-osx.rb 2012-0 git checkout 174acd6 Lib RARY/FORMULA/HTOP-OSX.RB 0.8.2.1-2012-04-18 git checkout 258c649 library/formula/htop-osx.rb$ cd/usr/local$ git Checkout-b htop0.8.2.1 8e24412 # Checkout out historical version switched to a new branch ' htop0.8.2.1 ' ^_^/usr/local $ git branch* h top0.8.2.1 master$ Brew unlink htopunlinking/usr/local/cellar/htop-osx/0.8.2.2 ... 4 links removed ^_^/usr/local $ brew Install htop # Install old version ==> installing htop-osx==> downloading Https://git hub.com/max-horvath/htop-osx/archive/0.8.2.1-2013-03-31.tar.gz ^_^/usr/local $ ls/usr/local/cellar/htop-osx/ 0.8.2.1 0.8.2 ^_^/usr/local $ htop--versionhtop 0.8.2.1-(C) 2004-2008 Hisham MuhAmmad. Released under the GNU GPL. ^_^/usr/local $ brew Switch htop 0.8.2.2 # toggle Htop version cleaning/usr/local/cellar/htop-osx/0.8 .2.1cleaning/usr/local/cellar/htop-osx/0.8.2.24 links created for/usr/local/cellar/htop-osx/0.8.2.2 ^_^/usr/local $ Htop--versionhtop 0.8.2.2-(C) 2004-2008 Hisham muhammad.released under the GNU GPL. ^_^/usr/local $ brew Switch htop 0. 8.2.1 # Delete A version of the word, the version switch, then delete, the last version of the switch back cleaning/usr/local/cellar/htop-osx/0.8.2.14 links created for/usr/local/cellar/ htop-osx/0.8.2.1 ^_^/usr/local $ brew Remove htopuninstalling/usr/local/cellar/htop-osx/0.8.2.1 ...
The Homebrew is actually a flexible application of the GIT branch.
Delete dependencies when formula is deleted
$ brew remove formula$ brew rm $(join <(brew leaves) <(brew deps formula))
Homebrew Cask
Install the app via homebrew Cask, first to install
$ brew tap caskroom/cask && brew install brew-cask
The default homebrew cask installs the app to /opt/homebrew-cask/Caskroom
the bottom and links to the ~/Applications
directory.
Configuration, let the app link to ~/My Applications
the next
$ mkdir ~/My\ Applications$ touch ~/My\ Applications/.localized$ echo ‘export HOMEBREW_CASK_OPTS="--appdir=~/My\ Applications"‘ >> ~/.bash_profile$ source ~/.bash_profile
And then I installed it randomly.
$ brew cask search firefox$ brew cask install firefox
How to use Mac Homebrew