For OS X 10.12
If you get this error when installing the npm package canvas
$ npm install canvas
npm WARN gentlyRm not removing /Users/simon/repos/mac-setup/node_modules/.bin/rimraf as it wasn't installed by /Users/simon/repos/mac-setup/node_modules/rimraf
> canvas@1.6.6 install /Users/simon/repos/mac-setup/node_modules/canvas
> node-gyp rebuild
./util/has_lib.sh: line 31: pkg-config: command not found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
...
Resolve it by installing these packages
$ npm install -g node-gyp
$ brew install pkg-config cairo libpng jpeg giflib