Mac-Homebrew安裝

Homebrew介紹

Homebrew主要用于解決軟件依賴包的關系。如其他linux系統Red hat有yum,Ubuntu有apt-get。可以說Homebrew就是mac下的apt-get、yum。

Homebrew安裝

1.在終端中輸入以下代碼:
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1
2.安裝完畢后,執行命令查看是否安裝成功。執行命令:brew
Please run brew update!
3.根據執行brew提示,要求我們執行brew update。那我們就執行
brew update
執行命令會出現這樣的錯誤信息:
Error: /usr/local must be writable!
問題的原因是由于/user/local目錄沒有權限。這里我們給該目錄進行授權。

    如:sudo chown -R CalvinMackBook /usr/local```
4.執行:brew update

Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 1057, done.
remote: Compressing objects: 100% (968/968), done.
remote: Total 1057 (delta 100), reused 445 (delta 50), pack-reused 0
Receiving objects: 100% (1057/1057), 1.02 MiB | 23.00 KiB/s, done.
Resolving deltas: 100% (100/100), done.
From https://github.com/Homebrew/brew

  • [new branch] master -> origin/master
    HEAD is now at 9a0116d Merge pull request #2126 from reitermarkus/spec-install
    To restore the stashed changes to /usr/local run:
    'cd /usr/local && git stash pop'
    ==> Homebrew has enabled anonymous aggregate user behaviour analytics.
    Read the analytics documentation (and how to opt-out) here:
    http://docs.brew.sh/Analytics.html

==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4158, done.
remote: Compressing objects: 100% (4012/4012), done.
remote: Total 4158 (delta 30), reused 443 (delta 9), pack-reused 0
Receiving objects: 100% (4158/4158), 3.32 MiB | 25.00 KiB/s, done.
Resolving deltas: 100% (30/30), done.
Tapped 4009 formulae (4,189 files, 10.4M)
Already up-to-date.
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run brew update.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run brew update.
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
sudo chown root:wheel /usr/local

從安裝信息我們可以看到,需要我們刪除/usr/local/share/doc/homebrew目錄,然后再執行安裝。

==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Could not link:
/usr/local/share/doc/homebrew

Please delete these paths and run `brew update````
執行刪除目錄的命令:
rm -r -f /usr/local/share/doc/homebrew

繼續執行brew update
brew update

5.安裝更新成功!

Homebrew基本使用

搜索軟件:brew search 軟件名
brew search wget

安裝軟件:brew install 軟件名
brew install wget

卸載軟件:brew remove 軟件名
brew remove wget

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容