【轉】 Homebrew – OSX下簡單的包管理系統

來源:互聯網
上載者:User

標籤:des   style   http   os   使用   io   strong   ar   for   

很多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協助



The brew command

Use man brew to view the manpage.

Command Description
brew --cache Print path to Homebrew’s download cache (usually ~/Library/Caches/Homebrew)
brew --cellar Print path to Homebrew’s Cellar (usually /usr/local/Cellar)
brew --config Print system configuration info
brew --env Print Homebrew’s environment
brew --prefix Print path to Homebrew’s prefix (usually /usr/local)
brew --prefix [formula] Print where formula is installed
brew audit Audit 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] --cache Generate 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 doctor Check your Homebrew installation for common issues
brew edit Open 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 home Open Homebrew’s homepage in your browser
brew home [formula] Opens formula ’s homepage in your browser
brew info Print 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 outdated List formulae that have an updated version available (brew install formula will install the newer version)
brew prune Remove dead symlinks from Homebrew’s prefix4
brew remove [formula] Uninstall formula
brew search List 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 update Update formulae and Homebrew itself
brew upgrade Install 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.

【轉】 Homebrew – OSX下簡單的包管理系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.