HomeBrew安裝
-
官網(wǎng)安裝
網(wǎng)址:https://brew.sh/
安裝:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
卸載:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
-
國內鏡像安裝【推薦】
有選擇國內源的選項套菜,檢查Git環(huán)境是否設置代理等
安裝:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
卸載:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
常用命令
安裝軟件:brew install xxx
卸載軟件:brew uninstall xxx
搜索軟件:brew search xxx
更新軟件:brew upgrade xxx
查看列表:brew list
更新brew:brew update
清理所有包的舊版本:brew cleanup
清理指定包的舊版本:brew cleanup $FORMULA
查看可清理的舊版本包嵌巷,不執(zhí)行實際操作:brew cleanup -n
Git 設置代理 加速pod install等
-
全局設置代理
git config --global http.proxy socks5://127.0.0.1:1080
-
僅GitHub設置代理,國內Git不設置
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
-
取消代理
git config --global --unset http.proxy
git config --global --unset http.https://github.com.proxy
nvm安裝與使用
在不同項目中可能使用不同的node版本骤星,可以使用NVM(node.js version management)來管理node版本
-
安裝nvm之前先檢查電腦是否有安裝過node株汉,卸載之前安裝的node败明,使用nvm重新install node版本進行管理
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
-
安裝
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
執(zhí)行之后使用nvm --version
查看是否安裝成功,如提示找不到nvm:command not found: nvm
則配置環(huán)境變量野宜,以Mac為例
如使用bash碗殷,則
sudo vim ~/.bash_profile
(zsh 則sudo vim ~/.zshrc
) 打開編輯模式,將如下例環(huán)境變量添加其中速缨,最后source ~/.bash_profile
使其生效
[ -s "$NVM_DIR/nvm.sh" ] && \."$NVM_DIR/nvm.sh" # This loadsnvm
[ -s "$NVM_DIR/bash_completion" ] && \."$NVM_DIR/bash_completion" #This loads nvm bash_completion
- nvm常用命令
nvm install stable #安裝最新穩(wěn)定版 node
nvm install <version> #安裝指定版本锌妻,如:安裝v4.4.0,nvm install v4.4.0
nvm uninstall <version> #刪除已安裝的指定版本旬牲,語法與install類似
nvm use <version> #切換使用指定的版本node(臨時)
nvm ls #列出所有安裝的版本
nvm alias default <version> #切默認版本如: nvm alias default v11.1.0