包管理器--Homebrew 的安裝
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew 命令
brew search * -搜尋
brew install * -安裝
brew uninstall * -解除安裝
brew list —列出已安裝的軟體
brew update —更新Homebrew
brew home *—用瀏覽器開啟
brew info *—顯示軟體內容資訊
brew deps * — 顯示包依賴
brew server * —啟動web伺服器,可以通過瀏覽器訪問http://localhost:4567/ 來同網頁來管理包
brew -h brew —幫助
中科大 homebrew 映象
cd /usr/local/
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git
brew update
如果有問題,如下操作:
cd ~/tmp
git clone http://mirrors.ustc.edu.cn/homebrew.git
rm -rf /usr/local/.git
rm -rf /usr/local/Library
cp -R homebrew/.git /usr/local/
cp -R homebrew/Library /usr/local/
brew update
安裝 node-canvas (原始碼安裝)
1.pkg-config
$ curl http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz -o pkgconfig.tgz
$ tar -zxf pkgconfig.tgz && cd pkg-config-0.28
$ ./configure --with-internal-glib && make install
2.pixman
$ curl http://www.cairographics.org/releases/pixman-0.30.0.tar.gz -o pixman.tar.gz
$ tar -zxf pixman.tar.gz && cd pixman-0.30.0/
$ ./configure --prefix=/usr/local --disable-dependency-tracking
$ make install
3.libpng & export …
$ brew install libpng
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig
4.node-canvas
$ npm install canvas
or from source:
$ node-gyp rebuild
5.如果出現錯誤
Error: error while reading from input stream
or:
Error: Image given has not completed loaded
安裝如下庫:
brew install giflib # for .gif files
brew install libjpeg # for .jpg files
再重新編譯 node-canvas