Mac使用終端安裝Homebrew(brew)


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

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

 

[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/local

2、在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的指令更新。

3、更新完成后的提示如下圖所示:

4、常用的三條語句搜索(search)、更新(install)、卸載(remove)

搜索:brew search SoftwareName

更新:brew install SoftwareName

卸載:brew remove SoftwareName

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

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

Last login: Wed May 10 08:44:45 on console
userdeMacBook-Pro:~ lijinkui$ sudo chmod -R g+w /usr/local
Password:
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-functions

Press 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 -9806
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force --depth=1
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

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at f1d4c4b Merge pull request #2607 from MikeMcQuaid/travis-ci-tweaks-2
==> Tapping homebrew/core
Cloning 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 0
Receiving 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.1

Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/doc/homebrew

Please 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.sh
userdeMacBook-Pro:~ lijinkui$ brew update
Already up-to-date.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM