Gokhan Arik
Gokhan Arik

Reputation: 2766

How to get iOS version of a device from command line?

I was trying to find a way to get iOS version of a device from command line, like adb devices in Android, but I couldn't find any solution. All the answers I found were explaining how to obtain it from application.

Is there any way to get iOS version of a device/devices from command line?

Thanks

Upvotes: 2

Views: 9320

Answers (3)

Americo Savinon
Americo Savinon

Reputation: 2649

Instruments is now deprecated and now the recommended way is to use xctrace. To the get list of available devices on your system you can run:

xcrun xctrace list devices

To get more options on xctrace, run: man xctrace

Upvotes: 2

P Shaw
P Shaw

Reputation: 121

Run sw_vers at the command prompt after you have ssh'ed into the iDevice

iPhone:~ root# sw_vers
ProductName:    iPhone OS
ProductVersion: 9.0.2
BuildVersion:   13A452

Upvotes: 3

Gokhan Arik
Gokhan Arik

Reputation: 2766

After some research, I found that instruments has instruments -s devices command.

When you run the command, it will list all Known Devices, but the ones connected will be on top of the list with their Serial Number.

A similar output is that:

admin$ instruments -s devices
Known Devices:
test iPhone (v7.1.1) (deviceserialnumber)
test iPhone 5S (v7.1.1) (deviceserialnumber)
iPhone - Simulator - iOS 7.1
iPhone Retina (3.5-inch) - Simulator - iOS 7.1
iPhone Retina (4-inch) - Simulator - iOS 7.1

I used sed command to get only Serial Number and iOS Version:

instruments -s devices | sed -n -E -e 's/.*v(.*)\) \((.*)\)/\2 \1/p'

And the output will be:

deviceserialnumber 7.1.1
deviceserialnumber 7.1.1

Upvotes: 3

Related Questions