Apple Tips
Using a U.P.S. System with a Desktop Mac
A desktop Mac’s hardware and/or data can be damaged by electric power problems: spikes, dips ("brownouts"), and sudden power losses.
Do yourself a large favor -- get a U.P.S. system ("Uninterruptible Power Supply," aka battery backup). You can now get them with a USB cable that connects to your Mac, for under $70 (for most desktop Macs). It will run your Mac (and external HD, modem, etc, but not a printer) for at least a few minutes, and will signal OSX (via the USB cable) when it's switched from utility power to battery, so OSX can do a controlled power-down.
Thus you're protected against both surges and dips in power, and your Mac won't have an abnormal shutdown when they occur, which can damage your file system.
You can also get systems that will run your Mac longer, but of course they’ll cost more.
Most have two sets of outlets; one for battery back-up, another for surge protection only. Many also have sockets to protect telephone and/or cable TV lines, too.
No U.P.S. (or surge protector) is perfect; there’s a small chance that a direct lightning strike on your power lines might be too much for it. Most of the makers include a policy that will replace your equipment if it’s damaged in such circumstances, and some will pay for data recovery, too.
When you connect the USB cable, you'll get a new set of options in System Preferences > Energy Saver, where you can tell OSX when to do the shutdown -- after a specified number of minutes on battery; and/or when the battery is at a specified percentage; and/or when there's a specified number of minutes left on battery power. See the screen samples below.
SNOW LEOPARD 10.6.x and later Energy Saver System Preferences
When you click it, you’ll see a separate, slightly-different version.
These settings are in effect only while running on battery power.
(Some other options will vary by Mac and version of OSX.)
Note: the Start up automatically ... box may not work, depending on the timing and your UPS. Before shutting down, OSX tells the UPS to stop supplying power after 4 minutes, and to restore power 3 minutes after utility power is restored. Thus if utility power is restored within that 4-minute window, the UPS won’t power off and back on, so OSX won’t see power cut, then restored. Also, not all UPS systems support this feature; the APC "Back UPS ES" series does not appear to.
If you select multiple options, your Mac will shut itself down when the first condition is met.
LEOPARD 10.5.x Energy Saver System Preferences
When you click it, you’ll see separate, slightly-different versions of the usual windows, with another group of settings that are in effect only while running on battery power.
The UPS tab shows the Shutdown options.
If you select multiple Shutdown options, your Mac will shut itself down when the first condition is met.
If power is restored before that, of course, your Mac will continue running normally (but the message won't disappear until you click OK).
When that message is sent to your screen, OSX also sends a "PowerManagement: UPS low power warning" message to your system.log. See the tan box in OSX Log Files if you're not sure how to find your system.log, and the blue box there to help decipher it.
Unfortunately, there's no similar message when the UPS switches back to utility power.
Note that OSX can only attempt a normal shutdown, similar to you doing a Shut Down from the Apple Menu. If an app has unsaved changes, and puts up a message asking if you want to save them, OSX will close all the other apps it can, but cannot complete the power-down without a response. Your Mac will continue to run until power is restored or the UPS runs out of battery power.
So if any such apps have an autosave feature, use it; and try not to leave your Mac running unattended for long with unsaved changes.
Most electronics stores sell U.P.S. systems, and of course you can buy them online (but as the batteries are heavy, they may be expensive to ship).
Some of the major makers are:
APC I've had good luck with them.
CyberPower Also worked well.
Some of those sites have features you can use to determine which of their products you need, to run your hardware for a selected period of time. (They tend to overestimate your requirements, since they assume running at full power). Just be sure to get one with a USB cable.
When OSX recognizes that you’ve connected the USB cable, you’ll see new options on the Energy Saver panel of System Preferences. If the U.P.S. comes with software to be installed on your computer . . . don’t -- OSX has it built-in. (In fact, installing APC's Power Chute software may prevent OSX from working properly -- you must uninstall it using the CD; don't just remove the icon from the System Preferences panel.)
Be sure to plug the UPS system into an outlet directly, not via a surge suppressor, extension cord, or power strip.