码迷,mamicode.com
首页 > 系统相关 > 详细

用 Homebrew 带飞你的 Mac

时间:2020-02-16 14:59:27      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:nbsp   环境   pre   哪些   emc   memcached   成功   软件包   remove   

Homebrew也称brewmacOS下基于命令行的最强大软件包管理工具,使用Ruby语言开发。类似于CentOSyum或者Ubuntuapt-getbrew能方便的管理软件的安装、更新、卸载,省去了手动编译或拖动安装的不便,更使得软件的管理更加集中化,解决了依赖包管理的烦恼。

安装

Homebrew 依赖于Xcode Command Line Tools,所以需先执行:

1
xcode-select --install

在终端中执行:

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

检查是否已安装成功:

1
2
3
4
$ brew -v

Homebrew 1.6.1
Homebrew/homebrew-core (git revision 0aeb7; last commit 2018-04-12)

 

基本用法

  基于brew安装的所有软件及其依赖均会安装到目录/usr/local/Cellar

  • Brew 帮助信息

 

$ brew help
    
Example usage:
  brew search [TEXT|/REGEX/]
  brew info [FORMULA...]
  brew install FORMULA...
  brew update
  brew upgrade [FORMULA...]
  brew uninstall FORMULA...
  brew list [FORMULA...]
    
Troubleshooting:
  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
  • 子命令帮助信息 brew help [COMMAND]brew [COMMAND] -h 用于查看具体某个子命令的帮助信息。
  • 服务管理 brew services 用于方便的管理 brew 安装的软件软件,类似于 Linux 下的 service 命令。
  • 查看brew services帮助信息:
$ brew services
    
brew services command:
    Integrates Homebrew formulae with macOS‘ launchctl manager.
    
    [sudo] brew services list
    List all running services for the current user (or root)
    
    [sudo] brew services run formula|--all
    Run the service formula without starting at login (or boot).
    
    [sudo] brew services start formula|--all
    Start the service formula immediately and register it to launch at login (or boot).
    
    [sudo] brew services stop formula|--all
    Stop the service formula immediately and unregister it from launching at login (or boot).
    
    [sudo] brew services restart formula|--all
    Stop (if necessary) and start the service immediately and register it to launch at login (or boot).
    
    [sudo] brew services cleanup
    Remove all unused services.
    
    If sudo is passed, operate on /Library/LaunchDaemons (started at boot).
    Otherwise, operate on ~/Library/LaunchAgents (started at login).
  • 查询服务列表:
$ brew services list
    
Name      Status  User    Plist
redis     stopped
php56     started shocker /usr/local/opt/php56/homebrew.mxcl.php56.plist
mongodb   started shocker /usr/local/opt/mongodb/homebrew.mxcl.mongodb.plist
memcached stopped
httpd     stopped
nginx     started shocker /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
etcd      stopped
mysql@5.6 started shocker /usr/local/opt/mysql@5.6/homebrew.mxcl.mysql@5.6.plist
  • 检查可更新的软件列表 brew outdated 可查询有更新版本的软件
brew outdated
wget (1.18) < 1.19.4_1
redis (3.2.8) < 4.0.9
brotli (1.0.3) < 1.0.4
glib (2.56.0) < 2.56.1
etcd (3.2.6) < 3.3.3
tmux (2.3_2) < 2.6
openssl@1.1 (1.1.0e) < 1.1.0h
mysql@5.6 (5.6.34) < 5.6.39
libzip (1.5.0) < 1.5.1
bash-completion (1.3_1) < 1.3_3
  • 清理软件 brew cleanup -n 列出需要清理的内容 brew cleanup 清理所有的过时软件 brew cleanup [FORMULA] 清理指定软件的过时包
  •  查看配置信息 brew config 用于查看 brew 所在环境及相关的配置情况
  • 诊断问题 brew doctor 诊断当前 brew 存在哪些问题,并给出解决方案

  • 仓库管理 brew tap 已安装的仓库列表 

$ brew tap
    
Updating Homebrew...
caskroom/cask
homebrew/core
homebrew/services
peckrob/php
phinze/cask

brew tap [--full] user/repo [URL] 添加仓库

brew untap tap 移除仓库

 

 

用 Homebrew 带飞你的 Mac

标签:nbsp   环境   pre   哪些   emc   memcached   成功   软件包   remove   

原文地址:https://www.cnblogs.com/unicorn2105/p/12316727.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!