-1

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

Thanks in advance..

Changdeo Jadhav
  • 706
  • 9
  • 23
  • 5
    Might benefit the community if you let us know where on the device we can locate the command line. – Mika Jul 07 '14 at 09:16
  • Yes, I meant iOS device connected to Mac system. – Changdeo Jadhav Jul 07 '14 at 09:23
  • You should've probably asked this in *Super User* rather than *Stack Overflow*, since it's not a programming question. – Neeku Jul 07 '14 at 09:25
  • Hey @Neeku thanks for the suggestion I will keep it mind henceforth. Btw I wanted to use it for one of program only. I do not know what made u think that way. :) – Changdeo Jadhav Jul 07 '14 at 09:40
  • Sorry I was being sarcastic. I understood what you were asking. – Mika Jul 07 '14 at 09:47
  • May I know why I am getting constant down votes for this question? It is related to programming since I want this information to incorporated in one my automation script. – Changdeo Jadhav Jul 07 '14 at 13:04

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,419
  • 2
  • 43
  • 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
  • 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