用 Homebrew 带飞你的 Mac
文章目录
Homebrew
也称brew
,macOS
下基于命令行的最强大软件包管理工具,使用Ruby
语言开发。类似于CentOS
的yum
或者Ubuntu
的apt-get
,brew
能方便的管理软件的安装、更新、卸载,省去了手动编译或拖动安装的不便,更使得软件的管理更加集中化,解决了依赖包管理的烦恼。
资料
安装
Homebrew 依赖于Xcode Command Line Tools
,所以需先执行:
1
|
xcode-select --install
|
在终端中执行:
1
2
|
/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 帮助信息
12345678910111213141516171819202122232425$ brew helpExample usage:brew search [TEXT|/REGEX/]brew info [FORMULA...]brew install FORMULA...brew updatebrew upgrade [FORMULA...]brew uninstall FORMULA...brew list [FORMULA...]Troubleshooting:brew configbrew doctorbrew install --verbose --debug FORMULAContributing:brew create [URL [--no-fetch]]brew edit [FORMULA...]Further help:brew commandsbrew help [COMMAND]man brewhttps://docs.brew.sh子命令帮助信息
brew help [COMMAND]
或brew [COMMAND] -h
用于查看具体某个子命令的帮助信息。例如,查看
install
命令的帮助详情:$ brew install -hbrew install [--debug] [--env=(std|super)] [--ignore-dependencies|--only-dependencies] [--cc=compiler] [--build-from-source|--force-bottle] [--include-test] [--devel|--HEAD] [--keep-tmp] [--build-bottle] [--force] [--verbose] formula [options ...]:Install formula.formula is usually the name of the formula to install, but it can be specifiedin several different ways. See [SPECIFYING FORMULAE](#specifying-formulae).If --debug (or -d) is passed and brewing fails, open an interactive debuggingsession with access to IRB or a shell inside the temporary build directory.If --env=std is passed, use the standard build environment instead of superenv.If --env=super is passed, use superenv even if the formula specifies thestandard build environment.If --ignore-dependencies is passed, skip installing any dependencies ofany kind. If they are not already present, the formula will probably failto install.If --only-dependencies is passed, install the dependencies with specifiedoptions but do not install the specified formula.If --cc=compiler is passed, attempt to compile using compiler.compiler should be the name of the compiler's executable, for instancegcc-4.2 for Apple's GCC 4.2, or gcc-4.9 for a Homebrew-provided GCC4.9.If --build-from-source (or -s) is passed, compile the specified formula fromsource even if a bottle is provided. Dependencies will still be installedfrom bottles if they are available.If HOMEBREW_BUILD_FROM_SOURCE is set, regardless of whether --build-from-source waspassed, then both formula and the dependencies installed as part of this processare built from source even if bottles are available.If --force-bottle is passed, install from a bottle if it exists for thecurrent or newest version of macOS, even if it would not normally be usedfor installation.If --include-test is passed, install testing dependencies. These are onlyneeded by formulae maintainers to run brew test.If --devel is passed, and formula defines it, install the development version.If --HEAD is passed, and formula defines it, install the HEAD version,aka master, trunk, unstable.If --keep-tmp is passed, the temporary files created during installationare not deleted.If --build-bottle is passed, prepare the formula for eventual bottlingduring installation.If --force (or -f) is passed, install without checking for previouslyinstalled keg-only or non-migrated versionsIf --verbose (or -v) is passed, print the verification and postinstall steps.Installation options specific to formula may be appended to the command,and can be listed with brew options formula.brew install --interactive [--git] formula:If --interactive (or -i) is passed, download and patch formula, thenopen a shell. This allows the user to run ./configure --help andotherwise determine how to turn the software package into a Homebrewformula.If --git (or -g) is passed, Homebrew will create a Git repository, useful forcreating patches to the software.搜索软件
brew search [TEXT|/REGEX/]
用于搜索软件,支持使用正则表达式进行复杂的搜索。例如,查询静态博客生成工具
hugo
:123456$ brew search hugo==> Searching local taps...hugo ✔==> Searching taps on GitHub...==> Searching blacklisted, migrated and deleted formulae...查看软件信息
brew info [FORMULA...]
用于查询软件的详细信息。例如,查看软件
hugo
的详细信息:12345678910111213141516$ brew info hugohugo: stable 0.38.2 (bottled), HEADConfigurable static site generatorhttps://gohugo.io//usr/local/Cellar/hugo/0.38.2 (32 files, 28.0MB) *Poured from bottle on 2018-04-19 at 10:11:29From: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git/Formula/hugo.rb==> DependenciesBuild: dep ✔, go ✔==> Options--HEADInstall HEAD version==> CaveatsBash completion has been installed to:/usr/local/etc/bash_completion.d以上查询所得信息,包含了软件的最新可用版本,本机是否已安装,本机已安装的版本,安装的路径、大小、时间、Tap 源,所依赖的包,以及安装的可选项等详细信息。而这些信息可以帮助我们很方便快捷的了解如何对该软件进行相应的操作。
安装软件包
brew install FORMULA...
用于安装一个或多个软件。例如,安装软件
hugo
:1$ brew install hugo安装软件命令执行之前,brew 一般会先检查更新 Homebrew 自身及 Tap 源。
更新软件包
brew upgrade [FORMULA...]
用于更新一个或多个软件,不指定软件名则更新所有软件。卸载软件包
brew uninstall FORMULA...
用于卸载指定的一个或多个软件brew uninstall --force FORMULA...
彻底卸载指定软件,包括旧版本已安装的软件列表
brew list
用于查询本机已安装的软件列表服务管理
brew services
用于方便的管理 brew 安装的软件软件,类似于 Linux 下的 service 命令。查看
brew services
帮助信息:12345678910111213141516171819202122232425$ brew servicesbrew services command:Integrates Homebrew formulae with macOS' launchctl manager.[sudo] brew services listList all running services for the current user (or root)[sudo] brew services run formula|--allRun the service formula without starting at login (or boot).[sudo] brew services start formula|--allStart the service formula immediately and register it to launch at login (or boot).[sudo] brew services stop formula|--allStop the service formula immediately and unregister it from launching at login (or boot).[sudo] brew services restart formula|--allStop (if necessary) and start the service immediately and register it to launch at login (or boot).[sudo] brew services cleanupRemove all unused services.If sudo is passed, operate on /Library/LaunchDaemons (started at boot).Otherwise, operate on ~/Library/LaunchAgents (started at login).查询服务列表:
1234567891011$ brew services listName Status User Plistredis stoppedphp56 started shocker /usr/local/opt/php56/homebrew.mxcl.php56.plistmongodb started shocker /usr/local/opt/mongodb/homebrew.mxcl.mongodb.plistmemcached stoppedhttpd stoppednginx started shocker /usr/local/opt/nginx/homebrew.mxcl.nginx.plistetcd stoppedmysql@5.6 started shocker /usr/local/opt/mysql@5.6/homebrew.mxcl.mysql@5.6.plist检查可更新的软件列表
brew outdated
可查询有更新版本的软件1234567891011brew outdatedwget (1.18) < 1.19.4_1redis (3.2.8) < 4.0.9brotli (1.0.3) < 1.0.4glib (2.56.0) < 2.56.1etcd (3.2.6) < 3.3.3tmux (2.3_2) < 2.6openssl@1.1 (1.1.0e) < 1.1.0hmysql@5.6 (5.6.34) < 5.6.39libzip (1.5.0) < 1.5.1bash-completion (1.3_1) < 1.3_3清理软件
brew cleanup -n
列出需要清理的内容brew cleanup
清理所有的过时软件brew cleanup [FORMULA]
清理指定软件的过时包123456789101112131415$ brew cleanupRemoving: /usr/local/Cellar/wget/1.18... (9 files, 1.6MB)Removing: /usr/local/Cellar/libxml2/2.9.4_2... (277 files, 9.8MB)Warning: Skipping redis: most recent version 4.0.9 not installedWarning: Skipping brotli: most recent version 1.0.4 not installedRemoving: /usr/local/Cellar/icu4c/60.1... (249 files, 66.9MB)Removing: /usr/local/Cellar/icu4c/60.2... (249 files, 67MB)Warning: Skipping glib: most recent version 2.56.1 not installedRemoving: /usr/local/Cellar/readline/7.0... (45 files, 2MB)Removing: /usr/local/Cellar/unixodbc/2.3.4... (39 files, 952.3KB)Removing: /Users/shocker/Library/Logs/Homebrew/go... (64B)Removing: /Users/shocker/Library/Logs/Homebrew/glide... (64B)...==> This operation has freed approximately 214.1MB of disk space.查看配置信息
brew config
用于查看 brew 所在环境及相关的配置情况123456789101112131415161718192021$ brew configHOMEBREW_VERSION: 1.6.1ORIGIN: https://github.com/Homebrew/brew.gitHEAD: 5a2817cb023ca5e929fe030d423002992bdabf1bLast commit: 7 days agoCore tap ORIGIN: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.gitCore tap HEAD: 0aeb738f9f10ba3edd4edda9551fe11441bec458Core tap last commit: 11 days agoHOMEBREW_PREFIX: /usr/localHOMEBREW_BOTTLE_DOMAIN: https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottlesCPU: quad-core 64-bit haswellHomebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/rubyClang: 9.1 build 902Git: 2.15.1 => /Library/Developer/CommandLineTools/usr/bin/gitCurl: 7.54.0 => /usr/bin/curlJava: 9.0.4macOS: 10.13.4-x86_64CLT: 9.3.0.0.1.1521514116Xcode: N/AXQuartz: N/A诊断问题
brew doctor
诊断当前 brew 存在哪些问题,并给出解决方案仓库管理
brew tap
已安装的仓库列表12345678$ brew tapUpdating Homebrew...caskroom/caskhomebrew/corehomebrew/servicespeckrob/phpphinze/caskbrew tap [--full] user/repo [URL]
添加仓库brew untap tap
移除仓库
源镜像
如果不用源镜像,那么就自带梯子或自建服务吧~
清华大学开源软件镜像站
中科大 LUG@USTC
ban.ninja
该源只镜像了二进制预编译包,即 Bottles 源
用 Homebrew 带飞你的 Mac的更多相关文章
- Homebrew简介及安装,Mac 包管理
Homebrew简介及安装 Homebrew官网 http://brew.sh/index_zh-cn.html Homebrew是神马 Linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两 ...
- 生信云实证Vol.12:王者带飞LeDock!开箱即用&一键定位分子库+全流程自动化,3.5小时完成20万分子对接
LeDock是苏黎世大学Zhao HongTao在博士期间开发的一款分子对接软件,专为快速准确地将小分子灵活对接到蛋白质而设计.LeDock优于大部分商业软件,在Astex多样性集合上实现了大于90% ...
- 一文带你趟过mac搭建appium测试环境的遇到的坑
做UI自动化,最难的一步就是在环境搭建上,怎么去搭建一个UI自动化测试的环境,会难住很多人,在Mac上搭建appium如何搭建呢,本文带着大家去领略如何在mac上搭建appium测试环境.下面就是详细 ...
- Homebrew 安装 Docker Desktop for Mac
无意中发现Homebrew现在已经支持Docker Desktop for Mac了,因此特意把原来通过 https://docs.docker.com/docker-for-mac/install/ ...
- Alpha阶段项目复审(小小大佬带飞队)
Alpha阶段项目复审 小组的名字 优点 缺点,bug报告(至少140字) 最终名次(无并列) 只会嘤嘤嘤队 题材比较新颖!游戏和记单词的结合 有浏览器不兼容问题 5 GG队 样式新颖,自动导入好评 ...
- Mac Pro 安装 Homebrew 软件包管理工具
Linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案,Red hat有 yum,Ubuntu有 apt-get. Mac os 中没有类似的东东,不过有第三方库支持 ...
- mac下 home-brew安装及php,nginx环境安装及配置
Homebrew官网 http://brew.sh/index_zh-cn.html Homebrew是神马 linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案, ...
- Mac OS X 程序员利器 – Homebrew安装与使用
Mac OS X 程序员利器 – Homebrew安装与使用 Homebrew安装与使用 什么是Homebrew? Homebrew is the easiest and most flexible ...
- ★10 个实用技巧,让Finder带你飞~
10 个实用技巧,让 Finder 带你飞 Finder 是 Mac 电脑的系统程序,有的功能类似 Windows 的资源管理器.它是我们打开 Mac 首先见到的「笑脸」,有了它,我们可以组织和使用 ...
随机推荐
- K3 WISE安全认证方式
k/3中间层注册三种安全认证方式: 交互式用户方式,网络服务方式,信任方式,是指组件服务中生成的COM+应用程序中的组件包的运行账户(注册中间层后产生很多ebo开头的和kdsvrmgr组件包). 三种 ...
- 打印module查看参数
module1下的index.js require('./test2') main.js require('./module1')和require('./module2') 打印每个文件的module ...
- 【gedit】 显示行号
打开gedit文本编辑器->Edit(编辑)->preferences(预设)->view(视图)->在Display line numbers前打勾->close
- 不停机修改线上 MySQL 主键字段 以及其带来的问题和总结思考
起因: 线上 user 数据库没有自增字段,数据量已经达到百万级.无论是给离线仓库还是数据分析同步数据,没有主键自增 id 都是杀手级的困难.所以在使用 create_time 痛苦了几次之后准备彻底 ...
- zabbix-2.4.5的安装配置与使用
系统最小化安装 环境: zabbix_server 12.1.1.1 zabbix_agent 12.1.1.2 zabbix_proxy 12.1.1.3 1.安装环境: ...
- redis 中主从、哨兵和集群分片模式这三个有什么区别 ?
集群分片 比如 5主5从,也就是说 数据过来之后会均匀的分配到5台服务器上面,5台服务器上面的数据是不同的,但是每个服务器都有一个从服务器,上面的数据跟这一台主服务器的数据是一样的: 也就是说,对于这 ...
- GitHub & OAuth 2.0 & JWT
GitHub & OAuth 2.0 & JWT https://www.rfcreader.com/#rfc6749 GitHub & OAuth https://www.b ...
- @ControllerAdvice + @ExceptionHandler 全局处理 Controller 层异常==》记录
对于与数据库相关的 Spring MVC 项目,我们通常会把 事务 配置在 Service层,当数据库操作失败时让 Service 层抛出运行时异常,Spring 事物管理器就会进行回滚. 如此一来, ...
- Codeforces#543 div2 A. Technogoblet of Fire(阅读理解)
题目链接:http://codeforces.com/problemset/problem/1121/A 真·阅读理解 题意就是 有n个人 pi表示他们的强度 si表示他们来自哪个学校 现在Arkad ...
- JarvisOJ Basic easyRSA
还记得veryeasy RSA吗?是不是不难?那继续来看看这题吧,这题也不难. 已知一段RSA加密的信息为:0xdc2eeeb2782c且已知加密所用的公钥: (N=322831561921859 e ...