OS X Mirroring and External Displays

I have a not-superfancy 21″ iMac at home. It’s got an old Dell 24″ DVI display attached with a Thunderbolt adapter. I’m generally a big fan of multiple displays on any computer I’m using, and this works out well when I want it, especially if I’m doing something with VMware Fusion that could use a full extra screen. But here’s the thing: In this particular setting, I don’t need or want the external display all the time. It’s connected via VGA to an old Mac mini that we occasionally use, which complicates things a bit more because of input switching. The display is from something like 2007, so it does nothing automatically.

No problem: If I don’t need it, I’ll just turn it off. However, the Thunderbolt adapter means that OS X always sees the display as present, even if it’s powered off. I find this annoying, especially when I launch an application that remembers it has windows on the external display. I have to turn the display on, make sure it’s on the DVI input, blah blah, just to move the window. It’s a small thing, but the grumpy accumulates.

Today, the obvious solution finally occurred to me: Just turn on display mirroring when the external display is unwanted. Command-F1, or Command-fn-F1 if you have media keys disabled.

This gathers everything to the internal iMac display and means OS X (and I) can just ignore the second display. Easy.

My Favorite Small Mac OS X 10.7 Features

As usual, some of the most interesting (to me) new features in the next release of Mac OS X are in the cheap seats, not on the highlight reel.  The following items are excerpted from http://www.apple.com/macosx/whats-new/features.html after today’s WWDC announcement of Mac OS X 10.7 Lion:


[Address Book] Yearless birthdays

You can now add birthdays to your contacts without including a year.

[FileVault 2] External drive support

FileVault 2 supports encryption of external USB and FireWire drives.

[Finder] Merge folders

When you try to combine two folders with the same name, the Finder now offers to merge them into a single folder.

[Internet Restore and Utilities] Built into Lion

OS X Lion includes a built-in restore partition, allowing you to repair or reinstall OS X without the need for discs.

[Networking] Low-power wake

In OS X Lion, your Mac can wake up for services such as file sharing, backup, and more without the need to turn on the monitor or attached USB devices.

[Networking] NFSv4 support

Lion includes support for NFSv4. // Not that I’ll use it, but anything that helps NFSv4 is a good thing in my book.

[QuickTime Player] Rotate clips

If you open a video and it’s upside down or sideways, just rotate it to make it right.

[Safari] Drag-and-drop downloads

You can drag downloaded files from the Downloads list to your desktop for easy organization.

[Screen Sharing] Per-user screen sharing

You can remotely log in to a Mac with any user account on that computer and control it, without interrupting someone else who might be using the computer under a different login. // This is going to be a Really Big One for some people.

[System] Windows migration

With OS X Lion, you can migrate all the information from your old PC to your new Mac. Lion automatically transfers your documents, contacts, calendars, email accounts (Outlook and Windows Live Mail), and photos stored in Picasa, and puts them in the appropriate applications. // Family IT guys, REJOICE!

[System Preferences] Custom desktop color

Now you can create a custom solid color from the color picker. // Solves a longstanding embarrassment, which is always good news.

[Time Machine] Local snapshots

OS X Lion lets you take the Time Machine experience with you when you’re away from your Time Capsule or backup drive. Time Machine keeps a spare copy of the files you create, modify, or delete right on your Mac. Now if you accidentally delete a file while on the road, you can recover it from a local copy.

[Time Machine] Encrypted backups

Keep your Time Machine backups secure by backing up to an external USB or FireWire drive encrypted with FileVault 2. // This is a Really Big One in general.

[Other Features] Resize from any edge

You can now resize a window from any side or corner. // Solves another (and more annoying) longstanding embarrassment.


I’m looking forward to the big stuff like Versions and Mission Control (not to mention the kinda-amazing Lion Server deal), but these little things are always my favorite part of a new Mac OS X release.

I Did Not Know: networksetup -setairportpower

I sometimes want to turn off my MacBook Pro’s Airport wireless to save battery, even though its battery capacity is kinda awesome.

I fiddle with the icon in the menu bar and get grumpy because that’s the way you make this change and ugh, I’m tired of that.  But guess what:

$ networksetup -setairportpower en1 on
$ networksetup -setairportpower en1 off

I Did Not Know: pbzip2

I just learned about pbzip2, which lets your multicore computer use more than one core when using the bzip2 compression algorithm.

On my Mac Pro at work, I installed it with MacPorts (`sudo port install pbzip2`). It is this kind of awesome:

$ ls -lh original.tar
-rw-r--r--  1 jmcmurry  staff   2.4G Feb  4 13:47 original.tar
$ time bzip2 -k -v original.tar
original.tar: 36.215:1,  0.221 bits/byte, 97.24% saved, 
2604288000 in, 71911733 out.

real	13m3.313s
user	12m50.536s
sys	0m3.773s
$ mv original.tar.bz2 bzip2.tar.bz2
$ time pbzip2 -k -v original.tar
Parallel BZIP2 v1.0.5 - by: Jeff Gilchrist [http://compression.ca]
[Jan. 08, 2009]             (uses libbzip2 by Julian Seward)

# CPUs: 8
BWT Block Size: 900k
File Block Size: 900k
-------------------------------------------
File #: 1 of 1
Input Name: original.tar
Output Name: original.tar.bz2

Input Size: 2604288000 bytes
Compressing data...
-------------------------------------------

Wall Clock: 119.369207 seconds

real	1m59.612s 
user	14m39.090s
sys	0m44.840s

Sweet. 6.57x faster by adding a “p” to my command line.

The resulting compressed .bz2 files aren’t exactly the same according to md5 (the pbzip2 output is a little larger, which makes sense due to the splitting of the work), but when they decompress, they’re both identical to the original .tar file.

See also: mgzip.

Mac OS X 10.6 Automator Services: Awesome

I’ve been enjoying how Automator in Mac OS X 10.6 lets you easily create services for simple little annoying things.  I expect it’ll take about three times longer to write about what I just did than it did to actually do it.

I’m always writing emails containing computer hostnames, and sometimes I want to include the full DNS name and IP address in those emails.  That’s especially handy when you’re writing about firewall rules, as I just was.

I created this simple Automator Service workflow in about 60 seconds.

When I select some text in a text editor and run this Service (context click, select the Service name), this happens:

“foo” -> “foo.domain.com [192.168.1.200]”

A few notes:

  1. “Get Specific Text” is grayed out because it’s disabled.  As you’ll find when writing Automator Services, you have to have some dummy text available to substitute for the selected text when developing your workflow.  You just disable this when you save the Service.  Easy, but confusing if you don’t know what’s going on.
  2. Be sure to check “Replaces selected text” at the top.  That means whatever you have selected in your text editing window will be replaced with the output of this script.
  3. Be sure to change “Pass input” in the “Run Shell Script” task to “as arguments”.  That makes $1 become your selected text.
  4. There is zero error checking.  You will probably blow up your computer and the Internet.

It actually took much longer to write this post, especially because WordPress didn’t want to create an image link for me.  Thanks, WordPress!