Automatically enable Xcode "Developer Mode" on computer lab workstations

After reimaging a computer lab workstation, the first time a user tries to build and run an Xcode 4 application, Xcode pops up the "Enable 'Developer Mode' on this Mac?" prompt, requesting an administrator password.

How can I automate this process (via a script), so that I don't have to go around to every workstation, create a new Xcode project, build and run it, and enter the admin password each time the workstations are reimaged?


As an administrator, run the following commands in Terminal (or Remote Desktop):

/usr/sbin/DevToolsSecurity -enable
/usr/sbin/dseditgroup -o edit -t group -a staff _developer