auto detect code on osx