參照官網(wǎng)上很簡單的一句安裝命令,
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安裝完畢后,發(fā)現(xiàn)使用brew命令,卻總是提示:-bash: brew: command not found
解決方式。其實(shí)解決這個(gè)問題真的很簡單。如下:
sudo vim .bash_profile,打開后接在后面添加,注意:不要換行
export PATH=/usr/local/bin:$PATH
保存,source .bash_profile使配置修改生效。
再次使用brew 命令就ok了。
在使用命令brew install node 安裝node時(shí)遇到以下錯(cuò)誤
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin16/rbconfig.rb:213: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Updating Homebrew...
Error: You must `brew link pkg-config` before node can be installed
而是按照提示 輸入brew link pkg-config 接著報(bào)錯(cuò)
Error: Could not symlink bin/pkg-config
Target /usr/local/bin/pkg-config
is a symlink belonging to pkg-config. You can unlink it:
brew unlink pkg-config
To force the link and overwrite all conflicting files:
brew link --overwrite pkg-config
To list all files that would be deleted:
brew link --overwrite --dry-run pkg-config
按照上面提示的依次輸入brew unlink pkg-config;brew link --overwrite pkg-config;brew link --overwrite --dry-run pkg-config;(每個(gè)分號單獨(dú)一條命令)問題解決