cscreen
I am the original developer of the command line display management utility, cscreen. The original version targeted OS X on PPC and is quite old. I have, however, received requests for a copy of this in situations where someone is still running an older Mac and either is installing it for the first time or is rebuilding their PPC Mac and wants to replace their original. This link should give you the old PPC version of cscreen.
I have also received requests for an upgraded Intel version of cscreen. I do not have a Retina display so I don't know how this will behave on such machines, but I have upgraded cscreen and recompiled it for Intel and switched to the new non-deprecated APIs. This link should give you the new Intel version of cscreen.
Naturally if you run into any problems, please let me know.
Updated 2012-11-07: I've pushed out a new version of cscreen Intel, adding the -i parameter which allows you to use display ID values in lieu of the index, when selecting a display to operate on. These display ID values come from OS X and are assigned permanently when a display is connected to the system. As a result they persist across reboots as well as when the displays are reordered (for example when making a new display primary). As a result you can script work targeting a specific display ID without worrying about index changes. Also I fixed a bug where running cscreen with only an index selection but no other options could potentially cause a resolution change.
Updated 2012-12-23: Yet another new version of the Intel version, this time making it a Universal binary, set up for both 32 and 64 bit systems. Merry Christmas!
September 5th, 2012 - 13:23
Cross posted at ASC with you. Sorry about that. BTW, the 4/28/08 version does well with my Intel-based 27″, but I will be updating to the new one. Many have inquired about getting the old one, but it went missing. This is from the Terminal.
$ cscreen
1 display found
Index Depth Width Height Refresh(Hz; LCD displays show 0)
1 32 2560 1440 0
$ cscreen -h
Usage: cscreen [-d ] [-x ] [-y ] [-r ] [-s ] [-v] [-m] [-f] [-l] [-h]
[-d ] : specifies the bit depth (bits per pixel)
[-x ] : specifies the width in pixels
[-y ] : specifies the height in pixels
[-r ] : specifies the refresh rate in Hz
[-s ] : specifies which display to use (defaults to main display)
use a as the option to -s to specify the action on all displays
[-v]: display valid modes (use -s to specify display or nothing for the default)
[-m] : require an exact match
[-f]: forces settings (ignores safety mechanisms; USE AT YOUR OWN RISK)
[-l]: lists the current displays and modes
[-p]: sets the requested display to be the primary display
[-h]: displays the usage
September 9th, 2012 - 16:33
Absolutely perfect – exactly what I was looking for to help make an AppleScript to switch to 1080p and launch XBMC – thank you!
September 25th, 2012 - 12:11
Hi! I have downloaded the program. Where do I put it so I can launch a terminal session and run it without having to direct the entry all the way to the directory (i.e. /usr/foo/cscreen)? Do I need to change the permissions to run it?
I’m comfortable with existing programs that Apple installs, but I’ve only used used a package manager in the past to add new programs. I don’t remember the name of it but it was a repository of useful add-ons back when OSX was still new.
Thanks!
Ian
September 25th, 2012 - 12:31
Hi Ian,
You are probably thinking of fink. Fink is intended to allow you to use typically non-OSX *NIX tools on OSX and Darwin. cscreen is a native app, albeit command line, so it wouldn’t be found there.
When you have pulled cscreen out of the .dmg, you can copy it anywhere you like that is in your path. Try ‘echo $PATH’ in Terminal to see what folders are currently in your path. If you are comfortable doing so, you can add a folder of your own choosing to your path. You will also need to set execute permissions as well (e.g. ‘chmod o+x cscreen’ in Terminal) when you get it into place.
If you are curious, here is a link I found after a quick Google search about how to alter your OSX PATH setting.
September 25th, 2012 - 12:42
Yup it was Fink (which I miss—had lots of cool easier things like wget instead of curl).
Actually I was a bit of an idiot. I can indeed run it by typing “cscreen” at the prompt (the program is at /usr/bin). What doesn’t work is “man cscreen” and that is why I thought it wasn’t working at all. However for now I should be able to work with it referencing your site for the man page.
Thanks!
Ian
September 25th, 2012 - 12:53
Ah… I think at one point I was considering putting together a man page but I wasn’t sure how much better that would be than just using the output from ‘cscreen -h’.
September 28th, 2012 - 11:49
Hi Lynn,
Thanks a ton for the Intel version!
I was trying to use cscreen to set the screen resolution of a remote OSX Lion terminal, but cscreen -v only lists 800×600 and 640×480 (with depth 32 and various refresh rates). The system boots with a resolution of 1280×1024, and System Preferences > Displays shows a long list of options starting from 1024×768 to 1920×1080.
The force (-f) switch also couldn’t set a resolution higher than 800×600.
I’m using the machine over VNC and running cscreen in an SSH session.
Any issue you can think of?
Thanks.
September 28th, 2012 - 20:11
A few things come to mind:
Are you running the server headless? I know you mentioned that you could navigate System Preferences but I’m wondering if you are removing the display during normal VNC connection.
Does your VNC server software have any settings to control resolution? If I recall correctly, some VNC server packages provide preset resolution configurations which would possibly affect what the display subsystem would report.
You mentioned that you are connecting via VNC but using cscreen via SSH. What happens when you launch Terminal in your VNC session and run it there? Do you see different results?
January 10th, 2013 - 15:44
Hi, Lynn –
Thank you for your impressive tool. It would suit my needs perfectly if it weren’t for the fact that I’m experiencing the same problem as Sirius, but with a different setup. I am on a mid-2010 iMac running 10.7.5. The iMac is connected to an Epson projector via an Apple-brand Mini DisplayPort to VGA adapter.
cscreen -v is only showing 640×480 and 800×600 options in a wide variety of refresh rates:
DisplayID Index Depth Width Height Refresh
5b81c5c1 1 16 640 480 90
5b81c5c1 2 32 640 480 90
5b81c5c1 3 16 640 480 95
5b81c5c1 4 32 640 480 95
5b81c5c1 5 16 640 480 100
5b81c5c1 6 32 640 480 100
5b81c5c1 7 16 640 480 120
5b81c5c1 8 32 640 480 120
5b81c5c1 9 16 800 600 90
5b81c5c1 10 32 800 600 90
5b81c5c1 11 16 800 600 96
5b81c5c1 12 32 800 600 96
5b81c5c1 13 16 800 600 100
5b81c5c1 14 32 800 600 100
5b81c5c1 15 16 800 600 120
5b81c5c1 16 32 800 600 120
5b81c5c1 17 16 640 480 60
5b81c5c1 18 32 640 480 60
5b81c5c1 19 16 640 480 73
5b81c5c1 20 32 640 480 73
5b81c5c1 21 16 640 480 75
5b81c5c1 22 32 640 480 75
5b81c5c1 23 16 640 480 85
5b81c5c1 24 32 640 480 85
5b81c5c1 25 16 800 600 56
5b81c5c1 26 32 800 600 56
5b81c5c1 27 16 800 600 60
5b81c5c1 28 32 800 600 60
5b81c5c1 29 16 800 600 72
5b81c5c1 30 32 800 600 72
5b81c5c1 31 16 800 600 75
5b81c5c1 32 32 800 600 75
5b81c5c1 33 16 800 600 85
5b81c5c1 34 32 800 600 85
However, the Displays preference pane shows resolutions from 800×600 up to 1920×1080. (Curiously, it doesn’t even show 640×480 options while cscreen does.) Like Sirius, I tried using the -f option without success.
– Steve
October 4th, 2012 - 10:20
I’m trying to run cscreen on my Hackintosh (which has a Pentium 4 CPU) but when I run cscreen I get the error:
sh: /usr/bin/cscreen: Bad CPU type in executable
At first I thought perhaps I had inadvertently downloaded the older PPC version of cscreen but making sure that I had your Intel version I reinstalled and got the same error. Since it’s a Hackintosh I know I’m in no man’s land but if you have any suggestions I would greatly appreciate them.
Thanks,
Darrell
October 4th, 2012 - 14:28
From what I can gather, the “Bad CPU type in executable” message typically occurs when there is a bitness mismatch in the executable, like trying to run a 64 bit executable on a 32 bit system.
You mentioned you are using a Pentium 4 CPU, which was at one point offered in 32 bit only varieties and eventually was offered with a 64 bit option as well. Do you happen to know what bitness you are set up to use? 32 or 64? The cscreen executable for Intel would almost certainly have been a 64 bit binary, so on a 32 bit system I would expect this error.
If that’s not the case, then it’s back to the drawing board.
October 4th, 2012 - 15:26
That sounds like the likely cause. It’s an old CPU so probably 32bit. Oh well, I’ll continue my pure Applescript approach.
Thanks for the help.
November 16th, 2012 - 23:12
I am also running a hackintosh hp mini 110 with osx 10.5.8 and i get the bad cpu type error as well with the intel version, and so for the heck of it i’ll give the old ppc version a shot and it works like a charm. hope this works for you as well darrell
October 14th, 2012 - 14:05
Hi, thank you for this program but … it does not work with my mid 2010 Mac Pro.
I have a DVI monitor which is seen but screen does not see my TV on another port. The configuration of the video card is the following :
DVI port : samsung monitor.
display port n°1 : nothing
Display port n°2 : display port to hdmi adapter -> TV
Any idea ?
October 17th, 2012 - 10:19
Michel, I’m not sure why cscreen wouldn’t see your display. I too have an external display connected via display port to HDMI adapter, though it’s an LG display and not a TV. Still, I wouldn’t think it would be a problem. Also I’m using a Macbook Pro, not a Mac Pro though again, can’t imagine that’s the issue. I can try hooking up my laptop to my TV to see what happens.
Out of curiosity, what happens if you use the other display port?
October 18th, 2012 - 00:10
Thanks for porting the cscreen utility.
I’m wondering if you could look implement the ability to explicitly specify which screen to address. While researching your utility, I came across another called fb-rotate (http://modbookish.lefora.com/2010/06/29/a-unix-utility-to-change-the-primary-display-on-os/) whereby you can manipulate screens based on an explicit DisplayID rather than display “index” which changes after running cscreen -p.
I feel that your cscreen -p is superior to the fb-rotate -m (as your’s brings the dock along and actually swaps displays completely (windows and all) whereas fb-rotate simply moves menubar) .. but I do like the -i switch of fb-rotate better since it allows me to truly understand screen *arrangement*, as well as fb’s added feature of being able to explicitly address the display by DisplayID.
Thanks for your efforts!
jpf
October 18th, 2012 - 19:46
Hi JP,
I’ll look into adding this.
-Lynn
October 19th, 2012 - 11:57
Excellent .. thanks!
November 7th, 2012 - 18:47
Hi JP,
I’ve pushed a new version of cscreen with the display ID as an option (use the -i switch).
Enjoy!
-Lynn
October 22nd, 2012 - 06:39
Hi Lynn,
is it possible to switch between 1080i and 1080p with cscreen? I can’t seem to figure out how to do this.
Thanks,
Robin
November 7th, 2012 - 17:04
Hi Robin,
Theoretically… maybe.
I suspect it depends on whether the 1080i and 1080p modes get listed as separate modes.
I’ll look into this a bit tonight while I’m working on JP’s request.
-Lynn
November 9th, 2012 - 10:59
Hello! Thanks for the great tool. I was wondering if it is possible to add screen rotation to this? One of the problems I have is my second monitor sometimes is not set to the correct resolution, so this tool should be able to help me with that – but I think since the display is currently set to 90 degrees rotation the resolution is not setting correctly. (either that or I’m using the tool incorrectly)
In any case, thanks!
November 17th, 2012 - 05:11
I’ll look into this as well.
November 18th, 2012 - 13:05
Hi, is it possible to switch to a HiDPI resolution? In mountain lion resolution list I can select 960 x 540 (HiDPI) mode which looks great in media center usage. It would be great if I could create a script with cscreen to change between 960×540(HiDPI) mode vs. 1080P for XBMC.
I tried to change resolution manually (cscreen -d 32 -x 960 -y 540 -r 60) but unfortunately the OS X didn’t pickup the HiDPI-mode.
December 23rd, 2012 - 05:20
Hi Ville,
By HiDPI resolution I assume you mean Retina? If so, you aren’t the only user having issues with Retina resolutions. I’ll need to play around with this a bit and see what’s what.
November 18th, 2012 - 16:00
I like the ability to switch which screen has the menu/dock.
I use $cscreen -s 2 -p from a dock icon.
Is there a way to keep the screen position as is?
I usually have to manually correct.
Thanks,
Eric
December 23rd, 2012 - 05:06
Hi Eric,
Do you mean after a reboot, your selection of which screen has the menu/dock doesn’t hold? Or that running the script from the dock icon makes the change and then it immediately reverts?
November 23rd, 2012 - 15:52
Hey, the tool is good and it does work as you intended in Retina Display Mac. However the screen looses clarity since natively retina display uses what they call a scaled resolution. I do not know how exactly it works so I can’t get around it.
December 23rd, 2012 - 05:19
Hi Cem,
You aren’t the only user having issues with the various Retina resolutions. I’m going to need to sit down and play around with things a bit more.
I did end up getting a new Macbook and opted for one with the Retina display (short story, old laptop’s battery was bulging and causing me problems) so I can do testing on my own machine without having to rely on others testing it blindly.
December 22nd, 2012 - 20:04
Thanks for this awesome cscreen utility. It works perfect on my 64bit Intel Macs. However, my 32bit Intel Macs do not work with cscreen. It looks like cscreen is 64bit only? I see the comment above, running on a Pentium. My CPU is not Pentium, it’s the CPU that Intel released before the Core 2 Duo. These CPU can only run 32bit executables.
Is it possible to recompile the utility for 32bit for those of us who have 32bit only CPU?
December 23rd, 2012 - 05:17
Hi Aaron,
Okay, I did a 30 second check in the Xcode settings and found the option to create a universal 32/64 bit binary. The newly built executable checks out as both types with the ‘file’ command and runs fine on my machine.
Grab an updated copy of the Intel .dmg file from the link above and give it a try. If that works, that would suggest that 32 bit users would also have the option of using cscreen, which.. “yay”.
December 29th, 2012 - 15:52
This is an awesome Christmas present indeed. I tried the new version on my 32bit Intel Mac and it worked perfectly!
Thanks!
January 1st, 2013 - 10:08
Happy new Year!!
look’s like you small app is the solution to my MediaCenter Problems. But, on a OSX 10.5 I get the error:dyld:
unknown required load command 0×80000022
Trace/BPT trap
Any ideas how I can run this on a 10.5 MacMini?
Cheers, Chris
January 1st, 2013 - 10:23
Hi Chris,
Happy New Year to you as well.
Can you tell me what specific version of OS X you are using (e.g. 10.5.8) and what processor your Mac Mini has (e.g. G4, Intel) and which cscreen .dmg file you grabbed?
From what I can tell, a number of things might be happening here, chief among them an architecture mismatch between the binary and the system you’re running on.
Regards,
-Lynn
January 8th, 2013 - 16:17
Hi!
Awesome program! Just one thing, when I use “cscreen -s 2 -p” my displays gets rearranged. I would like to keep the order when switching displays and to be able to switch them back (in the same order) with the same command. Is this possible?
If I wasn´t clear, the display order should always stay the same!
March 19th, 2013 - 17:05
Just wanted to say thanks. CSCREEN does exactly what I needed it to do (toggle the primary display). Fast, Easy, Terrific.