Homebrew介紹
Homebrew主要用于解決軟件依賴(lài)包的關(guān)系迁杨。如其他linux系統(tǒng)Red hat有yum,Ubuntu有apt-get凄硼∏π可以說(shuō)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.安裝完畢后狐史,執(zhí)行命令查看是否安裝成功。執(zhí)行命令:brew
Please run brew update!
3.根據(jù)執(zhí)行brew提示说墨,要求我們執(zhí)行brew update骏全。那我們就執(zhí)行
brew update
執(zhí)行命令會(huì)出現(xiàn)這樣的錯(cuò)誤信息:
Error: /usr/local must be writable!
問(wèn)題的原因是由于/user/local目錄沒(méi)有權(quán)限。這里我們給該目錄進(jìn)行授權(quán)尼斧。
如:sudo chown -R CalvinMackBook /usr/local```
4.執(zhí)行: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目錄姜贡,然后再執(zhí)行安裝。
==> Migrating HOMEBREW_REPOSITORY (please wait)...
Error: Could not link:
/usr/local/share/doc/homebrew
Please delete these paths and run `brew update````
執(zhí)行刪除目錄的命令:
rm -r -f /usr/local/share/doc/homebrew
繼續(xù)執(zhí)行brew update
brew update
5.安裝更新成功棺棵!
Homebrew基本使用
搜索軟件:brew search 軟件名
brew search wget
安裝軟件:brew install 軟件名
brew install wget
卸載軟件:brew remove 軟件名
brew remove wget