-1

Is there any way to know current battery level of connected iOS device from command line.

Thanks in advance..

Changdeo Jadhav
  • 696
  • 8
  • 21

1 Answers1

2

Check out libimobiledevice.

It is mainly targeted for linux systems but you can get it to compile for OS X as well if you want to although it is a bit complicated.

I am also in the process of writing an Objective C wrapper around the libraries and you can find some more info here: https://github.com/liamnichols/CocoaMobileDevice but be warned, its a WIP atm. I'm not even sure if it will run on other machines as there might be some hardcoded dependancies that need fixing.

liamnichols
  • 12,279
  • 2
  • 41
  • 62
  • Hi @liamnichols, I have got version of iibimobiledevice for MAC. As per documentation iDeviceInfo is tool. I tried it but I couldnt see any battery information in it. Any idea which tool from libimobiledevice gives this information – Changdeo Jadhav Jul 30 '14 at 14:51
  • 1
    @ChangdeoJadhav From what I remember, you should be able to run the `ideviceinfo -u -q com.apple.mobile.battery` command to get all the battery related info back. You can then use the `-k` parameter to query for a specific key. – liamnichols Jul 30 '14 at 16:13
  • Yes that was it, I forgot it. Thanks again :) – Changdeo Jadhav Jul 31 '14 at 09:34
  • Just want to point out, for anyone getting the `ERROR: Could not connect to lockdownd, error code -13` or similar errors on recent macOS versions, try installing with the `--HEAD` option. See https://stackoverflow.com/questions/35297388/battery-level-from-terminal/52571206#52571206 – luckman212 Sep 29 '18 at 18:19