At work, we run lots of tests for our product. We also reboot the headless minis after each reboot and want to with certainty that they are using the correct resolution. Our configuration management tool works best with command line applications. After searching around, I discovered that there isn't an application that could change resolution from the command line that was a native Intel binary.
I did find source to change resolutions, but it completely lacked any error checking and used APIs which were deprecated in 10.6 and absent in 10.7. I ended up writing a program that works on 10.6 and 10.7, has error checking, is released as a universal binary and is GPL code on github in hopes that others can use and help improve it.
Here is the download link for the installer package, and the source is available here.
Here's what it looks like when run:
$ screenresolution get Display 0: 1280x800x32 $ screenresolution list Available Modes on Display 0 1280x800x8 1280x800x16 1280x800x32 1280x800x30 1152x720x8 1152x720x16 1152x720x32 1152x720x30 1024x768x8 1024x768x16 1024x768x32 1024x768x30 1024x768x8 1024x768x16 1024x768x32 1024x768x30 1024x640x8 1024x640x16 1024x640x32 1024x640x30 800x600x8 800x600x16 800x600x32 800x600x30 800x600x8 800x600x16 800x600x32 800x600x30 800x500x8 800x500x16 800x500x32 800x500x30 640x480x8 640x480x16 640x480x32 640x480x30 640x480x8 640x480x16 640x480x32 640x480x30 720x480x8 720x480x16 720x480x32 720x480x30 720x480x8 720x480x16 720x480x32 720x480x30 $ screenresolution set 1280x800x32 Setting mode on display 0 to 1280x800x32
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110830215724984