Going back to using NSFileManager to check for executable rather than using 'which' because that wasn't causing the problem.