Search code examples
iphonemacosshellterminalusb

How to get iPhone name from osx terminal?


I am writing a simple script to download photos from an iPhone and then copy them to my server. I'd like to find the name of the iPhone that I currently have plugged in. So when I save my pictures I can save them in a folder named "currentDate/Dave's iPhone", "currentDate/Other iPhone", etc.

Wondering if there is a way to get the connected device's name from terminal. Ie. when I look at my device in Xcode or Image Capture it says my device name is Dave's iPhone.


Solution

  • Use libimobiledevice-macosx and its ideviceinfo utility:

    $ ideviceinfo | grep -i DeviceName
    

    If you get linker errors while running the executable, you may need to set the DYLD_LIBRARY_PATH environment variable to the path where you downloaded the library.