I fixed it by creating a separate keychain for building the app, imported the developer certificate into it. In my script that i run remotely, i unlock this keychain and voila the build now runs just like it does when i run it from the mac directly