How can I compile node-segfault-handler on mac OSX?

I am attempting to use https://github.com/ddopson/node-segfault-handler to debug a segmentation fault exception. I am running OSX 10.8.6

However, after running npm rebuild on the repository I receive the following error:

node example.js 

module.js:485
  process.dlopen(filename, module.exports);
          ^
Error: dlopen(/Users/xxx/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node, 1): no suitable image found.  Did find:
    /Users/xxx/lever/ats/node_modules/segvcatcher/build/Release/segvhandler_native.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:485:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/xxx/lever/ats/node_modules/segvcatcher/lib/segvhandler.js:7:16)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)

I just tested building it on "Mac OS X 10.7.5 (11G63)" and it works fine there. I don't have any boxes with OSX 10.8.6 to test that specifically, but I'd wager that the Node version matters more.

> segvcatcher@0.1.0 install /Users/Dopson/work/other/node-segfault-handler
> node-waf clean ; node-waf configure build

'clean' finished successfully (0.005s)
Checking for program g++ or c++          : /usr/bin/g++
Checking for program cpp                 : /usr/bin/cpp
Checking for program ar                  : /usr/bin/ar
Checking for program ranlib              : /usr/bin/ranlib
Checking for g++                         : ok
Checking for node path                   : ok /Users/Dopson/.node_libraries
Checking for node prefix                 : ok /usr/local/Cellar/node/0.8.18
'configure' finished successfully (0.032s)
Waf: Entering directory `/Users/Dopson/work/other/node-segfault-handler/build'
[1/2] cxx: src/segvhandler.cpp -> build/Release/src/segvhandler_1.o
[2/2] cxx_link: build/Release/src/segvhandler_1.o -> build/Release/segvhandler_native.node
Waf: Leaving directory `/Users/Dopson/work/other/node-segfault-handler/build'
'build' finished successfully (0.214s)

It failed the first time for me because my install of node-waf was borked (missing a python dep). I reinstalled node and it worked just fine. I used Homebrew and that installed Node v0.8.18.

It seem that problem lays in module source code. Try to check what arguments of macro NODE_MODULE corresponds to module name.