mac下安裝和使用brew

一,安裝brew
curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1

2,安裝完成后執(zhí)行
brew
提示:Please run brew update!

3,按照提示更新,執(zhí)行
brew update
報(bào)錯(cuò):Error: /usr/local must be writable!

4,賦給/usr/local目錄權(quán)限,執(zhí)行sudo chown -R $(whoami) /usr/local,即
sudo chown -R fxp /usr/local
其中fxp為系統(tǒng)當(dāng)前用戶名。

5,再次執(zhí)行
brew update
提示:
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
HEAD is now at c3f959d Merge pull request #1542 from woodruffw/deprecate-utils-json
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:
https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3757, done.
remote: Compressing objects: 100% (3647/3647), done.
remote: Total 3757 (delta 13), reused 305 (delta 1), pack-reused 0
Receiving objects: 100% (3757/3757), 3.00 MiB | 30.00 KiB/s, done.
Resolving deltas: 100% (13/13), done.
Checking connectivity... done.
Tapped 3636 formulae (3,784 files, 9.3M)
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

6,按照提示刪除/usr/local/share/doc/homebrew,執(zhí)行
rm -r -f /usr/local/share/doc/homebrew

7,再次執(zhí)行
brew update

安裝更新成功!

二,使用brew

命令行下執(zhí)行brew,用法提示如下:
Example usage:
brew search [TEXT|/REGEX/]
brew (info|home|options) [FORMULA...]
brew install FORMULA...
brew update
brew upgrade [FORMULA...]
brew uninstall FORMULA...
brew list [FORMULA...]

Troubleshooting:
brew config
brew doctor
brew install -vd FORMULA

Developers:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md

Further help:
man brew
brew help [COMMAND]
brew home

常用命令有安裝和卸載等,以安裝和卸載autojump為例:
安裝:sudo brew install autojump
卸載:sudo brew uninstall wget

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容