How to check device id of iPhone simulator?

IosIphoneIos Simulator

Ios Problem Overview


I want to check device id for my iPhone simulator application. But not using codebase. I know the way how to do with codebase, using UIDevice instance.

Is there any way to find device id without using codebase?

Ios Solutions


Solution 1 - Ios

EDIT: See other answers for the newer ways to view UDIDs for CoreSimulator-based simulators.

  1. instruments -s devices
  2. xcrun simctl list
  3. From Xcode: Window -> Devices and Simulators -> Simulators. The Identifier value is the UDID.

From 2011:

https://stackoverflow.com/questions/1520189/is-the-iphone-simulator-udid-unique-for-each-installed-instance/3429025#3429025

This answer should be what you want. Look at System Profiler on your mac and the id is there. I just tested on my machine and the IDs match.

This is the exact Terminal command you can enter to view it:

system_profiler SPHardwareDataType

Solution 2 - Ios

Try this

instruments -s devices

Solution 3 - Ios

As so often, there is a Xcode terminal tool for that (part of the Xcode tools) see xcrun manpage

xcrun simctl list | egrep '(Booted)'

lists only all booted (could be more than one) Simulators (remove | egrep '(Booted)' to see them all).

UIID results like

 iPhone 6 Plus (AAAABD40-9DE6-44B7-A4EA-B34ABCDEFCA6) (Booted)

you can then lookup a folder in ~/Library/Developer/CoreSimulator/Deviceson your Mac and find all the "belongings" of that particular Simulator

Solution 4 - Ios

You can also retrieve the same UDID, labeled as "Identifier". In the Xcode Window menu, select Devices and Simulators: enter image description here then select the Simulators tab: enter image description here

Solution 5 - Ios

You can search for just the booted devices and get the iOS version (different from @TiBooX's answer which just shows the active devices). You also don't need to use grep, you can just use the built in functionality of xcrun:

$ xcrun simctl list 'devices' 'booted'

Which will print out something like:

== Devices ==
-- iOS 10.3 --
-- iOS 11.4 --
-- iOS 12.4 --
-- iOS 13.4 --
    iPhone 11 Pro (A5DEEA78-1E82-472E-B7CC-FFD27741CDA2) (Booted)
-- tvOS 13.4 --
-- watchOS 6.2 --

I would recommend adding the following alias to your .bashrc or .zshrc:

# Get the active simulator with
alias active-sims="xcrun simctl list 'devices' 'booted'"

This way you can just run active-sims without remembering the entire line every time.

Solution 6 - Ios

Xcode -> Window -> Devices and Simulators -> Select Device for which you want identifier (Inside details you can see identifier)

Solution 7 - Ios

You can visually review the value in the simulator by navigating to home/Settings/General/About/Serial Number which is the same as your desktop machine. You can verify this by navigating to Apple/About This Mac and clicking the OS version number under OS X (the display will change to indicate your UDID - you may need to click it twice).

Solution 8 - Ios

There is another way without using command line, inside this plist file ~/Library/Developer/CoreSimulator/Devices/device_set.plist, it lists down all the devices with UUID.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMrunalView Question on Stackoverflow
Solution 1 - Iosuser244343View Answer on Stackoverflow
Solution 2 - IosStefanoView Answer on Stackoverflow
Solution 3 - IosTiBooXView Answer on Stackoverflow
Solution 4 - IosZackView Answer on Stackoverflow
Solution 5 - IosEric WienerView Answer on Stackoverflow
Solution 6 - IosvishaalkolheView Answer on Stackoverflow
Solution 7 - Ioscandyman888View Answer on Stackoverflow
Solution 8 - IosWeidian HuangView Answer on Stackoverflow