Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

uuid

ios

iphone

I am running automated tests on iOS devices. I want to not have to always have all devices connected. So I want to find all device id's and then only start the process of building, deploying, and running tests if that device is connected.

So my question is, how can I find the device uuid's of all connected devices through a shell script?

Thanks!

like image 810
SirRupertIII Avatar asked Jun 21 '13 14:06

SirRupertIII


2 Answers

Edit:

instruments command is now deprecated, you should run instead

xcrun xctrace list devices 

Previous answer:

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

instruments -s devices 
like image 131
Quanlong Avatar answered Sep 21 '22 21:09

Quanlong


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' 
like image 33
Jay Lieske Avatar answered Sep 24 '22 21:09

Jay Lieske