MacOS – How to retrieve current wattage info on OS X

applescriptcommand linemacospower

Is there a way to retrieve the current watt usage info on OS X Snow Leopard? I'm using mid-2010 iMac, so I'm not looking for just battery-related apps.

Does OS X even monitor power usage? Do I need to use an external reader between the power cord and the outlet?

I'm most interested in command-line/applescript based solutions for more convenient logging & stats, but I'm open for alternatives.


Both (@bmike's & @michaelmichael's) answers are undoubtedly correct. The meta–question in here was that is there any sensors/readers already on the PSU, that would work kind of like the way "kill-a-watt" works. I sense the answer for that is "no".

I know, it probably is just a wet dream, but a watt meter on board would be ideal for the computer to shout: "Look how eco-friendly I am; using just these watts!"


Ah!

@Kerri Shotts' suggested iStat Menus 3 do get the wattage readings from some sensor, along with volt and amp stats. So the meters are there, but how I could access them programmatically?


Bounty! Will be given for solid command-line sensor reading solution or for recommending exceptionally good 3rd party software (like one with statistical and historical data tools at minimum).

Just to inform: the aforementioned iStat Menus 3 lists the following power related sensors:

  • Voltage Sensors (Volts)
    • AC/DC
    • AC/DC
    • AC/DC Shunt
    • CPU
    • CPU 1.8V S0
    • CPU CTT
    • Graphics Module
    • Memory
  • Current Sensors (Amps)
    • AC/DC
    • CPU
    • CPU VTT
    • Graphics Module
  • Power Sensors (Watts)
    • AC/DC
    • CPU
    • Graphics Module

It does state "sensors", but they might be calculated as @msanford commented. How can I get my hands on that data programmatically?

Best Answer

system_profiler SPPowerDataType seems to provide the most relevant information. On laptops it reports voltage and amperage which can give you the power consumption (mVolts × mAmperes × 10^-6 = Watts). It also reports Wattage, but that's actually a piece of metadata reported by Apple's power adapter, third-party power adapters can show blanks here. Since desktops do not have rechargeable batteries, there's no way to calculate power consumption by measuring charging and discharging of battery.

But wait, there's still hope! Apple publishes a lot of source code, and googling for Wattage or Power+mV hints that certain kernel extensions can be queried about power consumption. Unfortunately, I cannot come up with a working script right now, but it seems possible.