Changing screen resolution from the command line on a Mac
So recently I was working on a mirror
and I ran into a problem setting the correct display resolution for the tv that makes up the “reflective” surface of the mirror. Basically the computer would think it was smarter than me and set a stretched resolution instead of a native one on reboot creating more of a fun house mirror effect than anything else.
McLeod Residence Mirror
The Barbarian Group and McLeod
topics: Installations, Processing, and Barbarian Labs
To solve the problem I knew I was going to have to script something so I started poking around in applescript and quickly realized that there was no library to change the resolution, and I’d have to default to using click actions and menu items. Needless to say, this is terrible idea so I gave up on applescript and started looking around for some command line tools.
I found cscreen, but the project has been closed up and the developer took down the app. Shucks. Then I asked the venerable Adam Miller
for a hand. After some google-ing we found this post in which a guy shares his code for a small C app to change the resolution. A few moments and a compile later and we had an app! An app that is super simple and works really well, in leopard even!
Adam Miller
Developer : Boston
topics: HTML, Agile and Scrum, Ruby on Rails, Technology Industry, and Creativity
Here is a zipped up copy of Newscreen, remember its command line only, so you’ll need to put it somewhere on your hard drive and use it from terminal, Mac only.
Here’s a usage example: newscreen -h 1440 -v 900
The other beautiful thing about this is that you can set custom resolutions. For instance, I have a Mac Mini at home that I use as a media hub and it’s hooked to an HDTV. The Mac Mini doesn’t have a decent recommended resolution for the TV so I was able to use this tool to set a custom res, and again it worked like a charm! Now it looks great and actually fits on the screen.
Oh and standard disclaimer here, this works for me but might not for you. Use at your own discretion, this is provided as-is no warranty implied or otherwise at all, ever. And I’m not responsible if it destroys your computer or files. Or if it murders anyone in your family.
UPDATE: as pointed out in the comments, this is intel only! for now. I’ll see if I can compile a universal version later.
10 comments
http://www.madrau.com/html/SRX/About.html
"Bad CPU Type in executable"
Are sure this file is a universal one? Or did you compile it for just intel?
"Bad CPU Type in executable"
Are sure this file is a universal one? Or did you compile it for just intel?
what version of mac osx are you using?
Many thanks!
Dean
-Andy
think you could tell me what version of mac os you have installed? the the graphics card that is in that thing?