How can I find the device uuid's of all connected devices through a command line script?

感情迁移 提交于 2019-11-28 04:53:35

If you have Xcode installed, you can use Instruments to get all known devices also. With

instruments -s devices

The answer from @KKendall set me on the right path. Here's a version with a single sed expression:

system_profiler SPUSBDataType | sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'
SirRupertIII

I found a similar question about using multiple devices here is my form of the answer that helped me:

 #!/bin/sh
 i=0
 for line in $(system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'); do
    UDID=${line}
    echo $UDID
    udid_array[i]=${line}
    i=$(($i+1))
 done

 cnt=${#udid_array[@]}
 for ((i=0;i<cnt;i++)); do
    echo ${udid_array[i]}
 done
Shiva krishna Chippa

install ideviceinstaller on Mac OS X via brew command: brew install ideviceinstaller

then idevice_id -l will work from terminal

Also ios-deploy can be used:

ios-deploy -c | grep -oE 'Found ([0-9A-Za-z\-]+)' | sed 's/Found //g'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!