Is there a way to get an iOS device battery level from terminal when it's plugged into the computer? I've looked into ioreg and that only displays my macbook's battery.
Asked
Active
Viewed 3,008 times
3 Answers
7
I was able to get this information as recently as macOS 10.14.2 using the libimobiledevice
formula from Homebrew. You may need to use the most recent version of the library, hence the --HEAD
appended to the install command:
$ brew install --HEAD libimobiledevice
After that, try these commands:
$ idevice_id --list
<UDID>
$ ideviceinfo -u <UDID> --simple
DeviceName: foo's phone
HardwareModel: D22AP
ProductName: iPhone OS
ProductType: iPhone10,3
ProductVersion: 12.0
$ ideviceinfo -u <UDID> --domain com.apple.mobile.battery
BatteryCurrentCapacity: 43
BatteryIsCharging: true
ExternalChargeCapable: true
ExternalConnected: true
FullyCharged: false
GasGaugeCapability: true
HasBattery: true
More information is available. Try ideviceinfo --help
to list the additional domains you can query.

luckman212
- 473
- 1
- 7
- 15
-
And you can also run `idevicediagnostics diagnostics` to get the detailed battery information. – Carter Feb 18 '23 at 18:24
-
Is there a way to get the charging power (watts)? – amdyes May 25 '23 at 02:43
2
You can use the command "cfgutil get batteryCurrentCapacity", you can get cfgutil by installing the command line tools for Apple Configurator.

Marc St Onge
- 61
- 3
-
1This doesn't work unless the phone is physically connected via USB unfortunately. Also, the command takes a _long_ time to complete (about 6 seconds on my system). I know this information is exposed somehow via WiFi (iTunes Sync protocol) because it shows up in [coconutBattery](https://www.coconut-flavour.com/coconutbattery/#idSCR). Anyone know how this is done? – luckman212 Sep 29 '18 at 17:32
-
@luckman212 were you ever able to figure out how to get battery level wirelessly? – Jack Chen May 07 '20 at 23:22
-
You can use [https://github.com/ios-control/ios-deploy], once a device is linked to xcode over wifi/ethernet. [https://stackoverflow.com/questions/44382841/how-do-you-perform-wireless-debugging-in-xcode-9-with-ios-11-apple-tv-4k-etc] – Marc St Onge May 11 '20 at 16:24
0
Seems like this might be doable via SSH
http://iphonedevwiki.net/index.php/SSH_Over_USB
Then with this command:

jackt
- 1
-
2Please post the commands in the answer so that if the links break, the answer stays. – Tah Feb 09 '16 at 17:06