Homebrew installation and basic operation commands

Homebrew installation and basic operation commands

Homebrew installation

Today I plan to install MySQL on MAC, because I don't want to install it by downloading the installation package, I want to install it through the command line, and I found the package management artifact (maybe the reason for my ignorance), that is "HomeBrew".

Through understanding, it is found that Homebrew is a missing package management tool under the macOS platform , with many useful functions such as installation, uninstallation, update, viewing, and searching. How simple is it? Package management can be achieved with just one instruction, without you having to care about various dependencies and file paths, which is very convenient and fast. Homebrew will install all these tools to the /usr/local/Cellardirectory and /usr/local/bincreate a symbolic link.

installation method

Fried chicken is simple

1. Visit HomeBrew official website

2. Copy and paste the command prompting installation to the terminal

homebrew

3. You need to press Enter several times during the installation process, 过程中需要用户输入用户管理员密码

install

4. Successful installation

brew_help

After the installation is complete, you can use the brew doctor command to check if there is any conflict
After the installation is complete, you can use the brew doctor command to check if there is any conflict
After the installation is complete, you can use the brew doctor command to check if there is any conflict


Basic operation

Pass brew -help, you can get some command help information of brew

Example usage:						# 使用的范例		
  brew search [TEXT|/REGEX/]			# 查询可用的包 [包名/正则匹配]
  brew info [FORMULA...]				# 包的信息
  brew install FORMULA...				# 安装包
  brew update							# 更新brew
  brew upgrade [FORMULA...]			 	# 更新包(如果不跟着包的名称,就是更新所有的已安装的包)
  brew uninstall FORMULA...				# 卸载包
  brew list [FORMULA...]				# 查询已安装的包的列表

Troubleshooting:									# brew的故障排除
  brew config											# 配置 
  brew doctor											# 修复
  brew install --verbose --debug FORMULA				# 安装调试

Contributing:
  brew create [URL [--no-fetch]]
  brew edit [FORMULA...]

Further help:				# 进一步的帮助信息获取
  brew commands
  brew help [COMMAND]
  man brew
  https://docs.brew.sh

Other commands

brew home [] 			# 用浏览器打开相关包的页面
brew deps [] 			# 显示包依赖
brew server 			# 启动web服务器,可以通过浏览器访问http://localhost:4567/ 来同网页来管理包
brew -h 				# brew帮助(同“brew -h”)

Some command examples

`brew install git`		# 安装git
`brew uninstall git`	# 卸载git
`brew search git`		# 搜索git
`brew upgrade git`		# 更新git
`brew deps *`			 	# 显示包依赖

Homebrew uninstall

The installation is as simple as Homebrew, enter the terminal.

$ cd `brew --prefix`
$ rm -rf Cellar
$ brew prune
$ rm `git ls-files`
$ rm -rf .git
$ rm -rf ~/Library/Caches/Homebrew

Guess you like

Origin blog.csdn.net/weixin_42250835/article/details/90113518
Recommended