mac homebrew的用法
与 MacPorts 类似,OS X 下还有款包管理工具为 Homebrew,安装方法也很简单。
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
好了,安装完毕,Homebrew 的使用方法也很简单。
基本用法
- brew search formula # 搜索软件包
- brew install formula # 安装软件包
- brew remove formula # 移除软件包
- brew cleanup formula # 清除旧包
- brew list # 列出已安装的软件包
- brew update # 更新 Homebrew
- brew upgrade # 升级软件包
- brew home formula # 用浏览器打开
- brew info formula # 显示软件内容信息
- brew deps formula # 显示包的依赖
- brew server # 启动 web 服务器,可以通过浏览器访问 http://localhost:4567 来通过网页来管理包
- brew -h # 帮助
- brew versions formula # 列出软件包的版本
具体的用法可以 man brew
。
brew search formula
这里主要说下,brew search formula 时有时会出现
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.
提示已经很明确了,按照说明照做,注册个 github 账号,打开页面 http://github.com/settings/applications. 点击 Create new token
,填入 Token descrption 后,点击 Create Token
在家目录的 ~/.bash_profile
中添加如下你申请到的 token
if [ -f /usr/local/bin/brew ]; then
export HOMEBREW_GITHUB_API_TOKEN=xxxxxxxxxx
fi
最后再 . ~/.bash_profile
更新下你的环境变量。
多版本共存
另外一个,安装不同版本的 formula 的技巧,比方要安装不同版本的 htop
$ brew versions htop # 显示 htop 的历史版本
Warning: brew-versions is unsupported and may be removed soon.
Please 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 Library/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 出历史版本
Switched to a new branch 'htop0.8.2.1'
^_^ /usr/local $ git branch
* htop0.8.2.1
master
$ brew unlink htop
Unlinking /usr/local/Cellar/htop-osx/0.8.2.2... 4 links removed
^_^ /usr/local $ brew install htop # 安装旧版本
==> Installing htop-osx
==> Downloading https://github.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 --version
htop 0.8.2.1 - (C) 2004-2008 Hisham Muhammad.
Released under the GNU GPL.
^_^ /usr/local $ brew switch htop 0.8.2.2 # 切换 htop 版本
Cleaning /usr/local/Cellar/htop-osx/0.8.2.1
Cleaning /usr/local/Cellar/htop-osx/0.8.2.2
4 links created for /usr/local/Cellar/htop-osx/0.8.2.2
^_^ /usr/local $ htop --version
htop 0.8.2.2 - (C) 2004-2008 Hisham Muhammad.
Released under the GNU GPL.
^_^ /usr/local $ brew switch htop 0.8.2.1 # 删除某版本的话,先版本切换,再删除,最后版本切换回来
Cleaning /usr/local/Cellar/htop-osx/0.8.2.1
4 links created for /usr/local/Cellar/htop-osx/0.8.2.1
^_^ /usr/local $ brew remove htop
Uninstalling /usr/local/Cellar/htop-osx/0.8.2.1...
其实就是 Homebrew 对 git 分支的灵活应用。
删除 formula 时删除依赖
$ brew remove formula
$ brew rm $(join <(brew leaves) <(brew deps formula))
Homebrew Cask
通过 homebrew cask 来安装 app,首先是安装
$ brew tap caskroom/cask && brew install brew-cask
默认 homebrew cask 安装 app 至 /opt/homebrew-cask/Caskroom
下,并链接到 ~/Applications
目录。
配置下,让 app 链接至 ~/My Applications
下
$ mkdir ~/My\ Applications
$ touch ~/My\ Applications/.localized
$ echo 'export HOMEBREW_CASK_OPTS="--appdir=~/My\ Applications"' >> ~/.bash_profile
$ source ~/.bash_profile
然后随便安装了
$ brew cask search firefox
$ brew cask install firefox
mac homebrew的用法的更多相关文章
- Mac Port 基本用法总结
Mac Port 基本用法总结 Mac Port 基本用法总结 1. Mac Port的下载地址 http://www.macports.org/install.php 2. Mac Port的说明文 ...
- Mac HomeBrew 常用命令
mac 系统常用的软件安装工具就是 homebrew, 其最常用的命令如下: 安装(需要 Ruby):ruby -e "$(curl -fsSL https://raw.github.com ...
- MAC Homebrew安装和简单使用
前言: 这个周六日在刚刚买的macbookpro(系统版本是:10.13.5)上面安装angular,一开始是按照windows上的顺序安装的,先安装node.js,然后在安装angular的时候报错 ...
- mac homebrew
brew 全称Homebrew 是Mac OSX上的软件包管理工具 Homebrew 安装和卸载工具 只用一行命令就能完成 官方地址: http://brew.sh/index.html ...
- Mac Homebrew安装php56 到phpstorm过程问题汇总
Mac自带版本是php5.5,本来是用homebrew安装xdebug 命令:brew install php55-xdebug 但是安装之后使用phpstorm还是有问题.php -v 并没有显示有 ...
- homebrew常见用法
1. 安装 Homebrew是mac下安装软件的好帮手, 是使用 ruby 写的,采用 github 来存放信息库,很方便吧. Ruby 已经内置,最好装上 Xcode,因为可能需要一些编译包.然后在 ...
- Mac/Homebrew brew update慢的方法
Homebrew是Mac的软件包管理器,我们可以通过它安装大多数开源软件.但是在使用brew update更新的时候竟然要等待很久.猜测可能是因为brew的官方源被墙或或者响应慢.于是想到的切换Hom ...
- mac homebrew安装
http://book.51cto.com/art/201107/278761.htm 3.2.3 使用 Homebrew 安装 Git Mac OS X 有好几个包管理器,用于管理一些开源软件在 M ...
- MAC——Homebrew介绍和使用
一.Homebrew是什么 Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装.卸载.更新.查看.搜索等很多实用的功能.简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径 ...
随机推荐
- ffmpeg为视频添加时间戳 - 手动编译ffmpeg
FFMPEG给视频加时间戳水印 项目中需要给视频添加时间戳,理所当然最好用的办法是ffmpeg.在找到正确的做法前,还被网上的答案timecode给水了一下(水的不轻,在这里转了2天),大概是这样写的 ...
- 我理解的Sitecore开发流程
Sitecore是一个强大的支持快速开发CMS建站的平台,进入sitecore后台可以看到 它主要有3个元素: 1.Templates模板 Data template:类似于面向对象编程中的类或结构体 ...
- 8. vim编辑器高级应用
1. vim主要模式介绍 命令模式.命令行模式.编辑模式 字符操作:i 当前插入, I行首插入, a当前字符之后插入,A行首插入, ESC退出当前模式 2. vim命令模式 3. vim插入模式 4. ...
- vue.js的一些知识点
1. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8& ...
- 我的js函数库(持续更新)
常用js初始化函数 function id(obj) { return document.getElementById(obj); } function bind(obj, ev, fn) { if ...
- sql查删更
//查询#SELECT * FROM user_cawefwfrd where usewwr_cawrqqd_qaid=2252227//删除#DELETE FROM user_cauyuyurd w ...
- Quartz定时任务简单实例
文章纲要: 初步搭建一个由Quartz为引擎集群的定时任务模块,功能为每隔30秒打印一条信息(Hello World!!!) 一.环境 Spring MVC Mevan Quartz 2.2.1 二. ...
- Web服务器与数据库服务器分离 导入 Excel数据至数据库
一般情况一般项目WEB服务器与数据库均部署在一台服务器,文件上传,数据导入在一台服务器完成.web服务器与数据库服务器分离,文件上传与数据导入将分布在两台服务器或多台服务器之间.本案例为两台服务器,具 ...
- OpenGL glMultMatrixf() glPushMatrix() glPushMatrix()浅析
我在之前的博客中曾提到过,OpenGL中坐标是采用行向量表示的,与之相对应的是,在矩阵变换中使用的是变换矩阵的转置,并且使用的是后乘的方式.本文直接使用下面的代码来及其后的图示来解释函数 p,li { ...
- ios项目里扒出来的json文件
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo; color: #000000 } p.p2 { margin: 0.0px 0. ...