【 Homebrew series 】
- HomeBrew regular use tutorial
- Homebrew进阶使用教程(一)
- Homebrew Advanced Tutorial 2 – Build your own repository with a command line weather client
- Install and connect to Homebrew on MAC
I lot address: making address: https://github.com/rangaofei/homebrew-saka
Homebrew is a package management tool under OSX, which makes it easy to manage various packages. The official definition is
MacOS missing package manager
The installation
1. Automatic installation (recommended)
Run the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code
The above command line is two commands, first download install file, and then use the system’s Ruby tool to install.
Try to install under bash or ZSH, fish will prompt that ‘$’ is not recognized.
You do not need to use super permission (sudo), this file will install HomeBrew to usr/local directory. During installation you will be prompted to tell you what actions to perform.
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
Copy the code
There will be some hints later. If you continue, you will be prompted for a password and wait for the installation to complete.
After the installation is complete, enter BREW -V to display whether the installation is successful:
Homebrew/ Homebrew-core (Git Revision Dba402; last commit 2018-01-09)Copy the code
2. Install the server manually
Run the following command:
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
Copy the code
Avoid the following two:
- The directory contains Spaces
- Do not install
/sw
or/opt/local
directory
Alternatively, you can manually download the installation script and change the value of the HOMEBREW_PREFIX variable to your own installation directory.
Common commands
1. Install and uninstall software
brew --version
orbrew -v
The BREW version is displayedbrew install <formula>
Install specified Softwarebrew unistall <formula
Uninstalling specified Softwarebrew list
Displays all installed softwarebrew search text
Search for local remote repository software, installed will show a green tickbrew search /text/
Use regular expression search software
One example: direct input
brew search gradle
Copy the code
The following information is displayed:
~/ brew search gradle
==> Searching localtaps... Gradle gradle- Completion [email protected] ==> Searching taps on bookmark... ==> Searching blacklisted, migrated and deleted formulae...Copy the code
Enter as a regular expression
brew search /gra\\wle/
Copy the code
The following information is displayed:
~/ brew search /gra\\wle/
==> Searching localtaps... Gradle gradle- Completion [email protected] ==> Searching taps on bookmark... ==> Searching blacklisted, migrated and deleted formulae...Copy the code
2. Upgrade the software
brew update
Automatically upgrade Homebrew (download the latest version from Github)brew outdated
Check outdated softwarebrew upgrade
Upgrade all obsolete software, that is, listed as obsolete softwarebrew upgrade <formula>
Upgrade the specified softwarebrew pin <formula>
Do not upgrade specified softwarebrew unpin <formula>
Unlock forbid upgradebrew upgrade --all
Upgrade all software packages, including uncleaned packages of older versions
3. Clean up
Homebrew does not clean up the old version when upgrading the software, we can use the following command to clean up after the software upgrade
brew cleanup -n
List what needs to be cleaned upbrew cleanup <formula>
Clean the specified software outdated packagesbrew cleanup
Clean up any outdated softwarebrew unistall <formula>
Uninstalling specified Softwarebrew unistall <fromula> --force
Complete uninstallation of specified software, including older versions
Files installed over BREW have environment variables automatically set, so don’t worry about the command line not starting. For example, once gradle is installed, you can run Gradle -v