Over VNC, configure the system to not use a second monitor while it's physically connected I have two monitors set up at work, with the external one set to a portrait configuration. When I attempt to VNC in to work remotely, this results in a HUGE (something like 1600x3000) because the virtual screen is the compositing of the two (with black bars where  there is no monitor space).

As a result, the VNC connection is non-responsive.

I'd like to be able to login via ssh and disable the second monitor via some command-line command or script. What commands might accomplish this?

Again, I am remote, so disconnecting the screen is not an option, and mirroring results in a screen that is about 1440x1440 (so it will fit onto both monitors with no stretching), so that is also a non-optimal strategy.

Output from xrandr:

themachine% xrandr -q
xrandr: Failed to get size of gamma for output default
Screen 0: minimum 640 x 480, current 2970 x 1680, maximum 2970 x 1702
default connected 2970x1680+0+0 0mm x 0mm
   1920x1080      60.0  
   640x480        60.0  
   800x600        60.0  
   1024x768       60.0  
   1280x1024      60.0  
   1280x720       60.0  
   1344x756       60.0  
   1600x900       60.0  
   1680x1050      60.0  
   2970x1680       1.0* 
   2970x1702       2.0
Depending on what type of Apple machine you are connecting to, you can try these commands and see if they work for you. I know they are used with X11..This is the command to disable dual screens (Assuming it's a laptop).

xrandr --output VGA --off


And if you want to this is a command to enable the dual screens (but might aid you in troubleshooting getting the secondary one off). LVDS is the liquid display and VGA is the secondary monitor.

xrandr --output VGA --mode 1024x768
xrandr --output VGA --right-of LVDS