This fails on Mac, where the B2G installation directory is B2G.app/Contents/MacOS. Instead of hardcoding "b2g" in the path here, define a B2G_BIN_DIR variable in the "platform-specific defines" section at the top of the file, set it to the platform-specific value, and reference it here.