Now on days, software components expose some sort of API using a REST interface. In addition, the typical response comes in JSON format. While this very convenient for a browser to interpret, using JSON in a bash script is not as simple. I came across this project on github called underscore and I must admit I liked it. I highly recommend reading it's short README file. I figured I'd write some about my issues installing it.
Underscore is a node.js solution (no surprise there). I have been a fan of node.js for sometime now, in particular for how you can get things done in my bash scripts. Installing underscore on Linux was not a problem at all (I tried my install on an Ubuntu VM). Once you have all the dependencies installed, there was no problem.
Installing it on a MAC OSX was a different issue. I detected a problem with the msgpack feature. In MAC OSX, brew did most of the work to install node, but doing something:
npm install -g underscore-cli
I got the following:
> email@example.com install /usr/local/lib/node_modules/underscore-cli/node_modules/msgpack
> node-gyp rebuild
gyp http GET http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
gyp: Error 1 running xcodebuild
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/Cellar/node/0.10.24/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.2
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.24/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/underscore-cli/node_modules/msgpack
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm WARN optional dep failed, continuing firstname.lastname@example.org
/usr/local/bin/underscore -> /usr/local/lib/node_modules/underscore-cli/bin/underscore
My fix: Install XCode. Once installed (free 2GB download), this problem disappeared.