Prevent iPhone from charging when plugged into a battery powered MacBook Air [duplicate]

I don't know if there is a software way to do that, but there is an hardware way:

  1. Use an unpowered USB cable (some company makes it, targeting audiophiles), might need an adapter to male lightning.
  2. Tape/Remove the power plugs on your USB cable.

Also, not exactly an answer to your question, but maybe to your use-case: Build a binary, then export it to iTunes, then upload via wifi. No debbuger and much less convenient tho.


Assuming the only other reason that you would connect your iPhone to your MacBook Air other than charging would be syncing. As far as I know there is no way to disable to charging aspect although you can work around it by syncing over WiFi rather than cable. Hope this helps!