Mac使用終端安裝Homebrew(brew)

Homebrew簡稱brew,OSX上的軟件包管理工具,在Mac終端能夠經過brew安裝、更新、卸載軟件。html

一、打開終端直接輸入下面指令回車:git

 

[objc]  view plain  copy
 
  1. //  
  2. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"  
  3. //  



 

 

注意:若是當前的用戶是管理員,須要對權限進行許可,在執行上面的指令前先執行:sudo chmod -R g+w /usr/localgithub

二、在1中指令回車後會提示「Press RETURN to continue or any other key to abort」(回車繼續或者按其餘鍵終止),這是直接回車進入「Downloading and installing Homebrew...」,若是網絡很差的話可能會提示「fatal: unable to access 'https://github.com/Homebrew/brew/': SSLRead() return error -9806...等」,不要緊從新輸入1的指令更新。ruby

三、更新完成後的提示以下圖所示:bash

四、經常使用的三條語句搜索(search)、更新(install)、卸載(remove)網絡

搜索:brew search SoftwareNameapp

更新:brew install SoftwareNamecurl

卸載:brew remove SoftwareName工具

(SoftwareName 是你須要處理的軟件名)fetch

五、下面是我安裝時的過程代碼(僅供參考):

Last login: Wed May 10 08:44:45 on consoleuserdeMacBook-Pro:~ lijinkui$ sudo chmod -R g+w /usr/localPassword:userdeMacBook-Pro:~ lijinkui$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"==> This script will install:/usr/local/bin/brew/usr/local/share/doc/homebrew/usr/local/share/man/man1/brew.1/usr/local/share/zsh/site-functions/_brew/usr/local/etc/bash_completion.d/brew/usr/local/Homebrew==> The following existing directories will be made writable by user only:/usr/local/share/zsh/usr/local/share/zsh/site-functionsPress RETURN to continue or any other key to abort==> /usr/bin/sudo /bin/chmod u+rwx /usr/local/share/zsh /usr/local/share/zsh/site-functions==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions==> Downloading and installing Homebrew...fatal: unable to access 'https://github.com/Homebrew/brew/': SSLRead() return error -9806Failed during: git fetch origin master:refs/remotes/origin/master --tags --force --depth=1userdeMacBook-Pro:~ lijinkui$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"==> This script will install:/usr/local/bin/brew/usr/local/share/doc/homebrew/usr/local/share/man/man1/brew.1/usr/local/share/zsh/site-functions/_brew/usr/local/etc/bash_completion.d/brew/usr/local/HomebrewPress RETURN to continue or any other key to abort==> Downloading and installing Homebrew...remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0HEAD is now at f1d4c4b Merge pull request #2607 from MikeMcQuaid/travis-ci-tweaks-2==> Tapping homebrew/coreCloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...remote: Counting objects: 4408, done.remote: Compressing objects: 100% (4213/4213), done.remote: Total 4408 (delta 37), reused 454 (delta 15), pack-reused 0Receiving objects: 100% (4408/4408), 3.52 MiB | 298.00 KiB/s, done.Resolving deltas: 100% (37/37), done.Tapped 4213 formulae (4,451 files, 11MB)==> Cleaning up /Library/Caches/Homebrew...==> Migrating /Library/Caches/Homebrew to /Users/lijinkui/Library/Caches/Homebre==> Deleting /Library/Caches/Homebrew...Already up-to-date.Error: Could not link:/usr/local/share/man/man1/brew.1Please delete these paths and run `brew update`.Error: Could not link:/usr/local/share/doc/homebrewPlease delete these paths and run `brew update`.==> Installation successful!==> Homebrew has enabled anonymous aggregate user behaviour analytics.Read the analytics documentation (and how to opt-out) here:  http://docs.brew.sh/Analytics.html==> Next steps:- Run `brew help` to get started- Further documentation:     http://docs.brew.shuserdeMacBook-Pro:~ lijinkui$ brew updateAlready up-to-date.

相關文章
相關標籤/搜索