Homebrew – OSX下简单的包管理系统

很多linux用户很喜欢 (Debian/Ubuntu)系列的apt包管理系统和(Redhat/Fedora)系列的yum包管理系统。 包括Windows用户都有多种方便的软件管理工具,如:360软件管理,QQ软件管理,迅雷软件管理等多种。 Mac OS X系统下面之前有老牌的Macports,Fink包管理系统(以后小编会陆续介绍),包括apple的官方Mac App Store。 本篇文章小编我主要介绍一下Homebrew一款比较新的,方便的包管理系统。

Homebrew让你免去无数.configure  , make 等命令。

下面简单介绍一下Homebrew和使用方法:

1. 安装前准备:

安装Xcode,去apple官方网站下载xcode 一般有1G多大小,下载地址: http://developer.apple.com/technologies/xcode.html

2. 安装homebrew

在终端的命令行状态下面执行一下命令:
sudo ruby -e “$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)”

3. 通过homebrew安装程序
Homebrew安装成功后,会自动创建目录 /usr/local/Cellar 来存放Homebrew安装的程序。 这是你在命令行状态下面就可以使用 brew 命令了.
通过 brew install就可以安装软件了,如图:

通过 brew search 就可以搜索程序,例如 brew search vim ,就可以搜索名称包括vim的程序。

4. 更新包
通过 brew update 就可以把包信息更新到最新,不过包更新是通过git命令,所以要先通过 brew install git 命令安装git。如图

5. 其他命令
brew list 显示已安装的包
brew home [] 用浏览器打开相关包的页面
brew info [] 显示包信息
brew deps [] 显示包依赖
brew server 启动web服务器,可以通过浏览器访问http://localhost:4567/ 来同网页来管理包
brew -h brew帮助



Use man brew to view the manpage.

CommandDescription
brew --cachePrint path to Homebrew’s download cache (usually ~/Library/Caches/Homebrew)
brew --cellarPrint path to Homebrew’s Cellar (usually /usr/local/Cellar)
brew --configPrint system configuration info
brew --envPrint Homebrew’s environment
brew --prefixPrint path to Homebrew’s prefix (usually /usr/local)
brew --prefix [formula]Print where formula is installed
brew auditAudit all formulae for common code and style issues
brew cleanup [formula]Remove older versions from the Cellar for all (or specific) formulae1
brew create [url]Generate formula for downloadable file at url, then open it in $BREW_EDITOR or $EDITOR2
brew create [tarball-url] --cacheGenerate formula (including MD5), then download the tarball
brew create --fink [formula]Open Fink’s search page in your browser, so you can see how they do formula
brew create --macports [formula]Open MacPorts’ search page in your browser, so you can see how they do formula
brew doctorCheck your Homebrew installation for common issues
brew editOpen all of Homebrew for editing in TextMate
brew edit [formula]Open [formula] in $HOMEBREW_EDITOR or $EDITOR
brew fetch --force -v --HEAD [formula]Download source package for formula; for tarballs, also prints MD5 andSHA1 checksums
brew homeOpen Homebrew’s homepage in your browser
brew home [formula]Opens formula ’s homepage in your browser
brew infoPrint summary of installed packages
brew info [formula]Print info for formula (regardless of whether formula is installed)
brew info --github [formula]Open Github’s History page for formula in your browser
brew install [formula]Install formula
brew install --HEAD [formula]Install the HEAD version of formula (if its formula definesHEAD)
brew install --force --HEAD [formula]Install a newer HEAD version of formula (if its formula definesHEAD)
brew link [formula]Symlink all installed files for formula into the Homebrew prefix3
brew list [formula]List all installed files for formula (or all installed formulae with no arguments )
brew options [formula]Display install options specific to formula.
brew outdatedList formulae that have an updated version available (brew install formula will install the newer version)
brew pruneRemove dead symlinks from Homebrew’s prefix4
brew remove [formula]Uninstall formula
brew searchList all available formula
brew search [formula]Search for formula in all available formulae
brew search /[formula]/Search for /formula/ (as regex) in all available formulae
brew unlink [formula]Unsymlink formula from Homebrew’s prefix
brew updateUpdate formulae and Homebrew itself
brew upgradeInstall newer versions of outdated packages

You can update outdated packages with any of the following:

  • brew upgrade
  • brew install `brew outdated`
  • brew outdated | xargs brew install

1 To delete a specific version, just go to the folder in the Cellar andrm -rf it; alternatively, drag it to the trash in Finder.

2 Homebrew tries to guess the formula name and version. If it fails, you’ll have to make your own template. I suggest copyingwget ’s.

3 Symlinking is automatically performed when installing formulae. It’s useful forDIY installation, or swapping out versions of a package you have multiple installs of.

4 This is generally not needed. However, it can be useful if you are doingDIY installations.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值