How to check device id of iPhone simulator?
Asked Answered
M

10

68

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?

Mural answered 5/8, 2011 at 6:26 Comment(0)
B
91

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:

Is the iPhone Simulator UDID unique for each installed instance?

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
Boiler answered 5/8, 2011 at 6:30 Comment(8)
I'm a bit confused by the Terminal command here. It gives me my Mac's device ID, not the simulator. Also how would it give a different ID based on which simulator I'm using? I want to know the ID for the device path in ~/Library/Developer/CoreSimulator/Devices/[ID]. This answer worked for me: https://mcmap.net/q/280082/-how-to-check-device-id-of-iphone-simulator.Jobber
When this answer was added in 2011, the device ID of the iPhone Simulator was the same as the Mac's. Simulators were stored in a folder per iOS version but were all very similar. You didn't have the Simulators pane that now exists in Xcode. Since then, the Simulator has been refactored and moved to the new CoreSimulator folder structure where multiple different simulators can be created, each with their own UUID.Boiler
Seems this shouldn't be marked as the answer anymore then.Jobber
This is not the correct answer any more , it would be good to update this or accept another answer? @MuralKarleenkarlen
Answer outdated.Afore
This is not the expected answer. It gives the mac information rather than the devices running on simulatorTransliterate
xcrun simctl list -j -v devices booted works for meForeshadow
Running instruments -s devices, it says instruments is now deprecated in favor of 'xcrun xctrace' --> xcrun xctrace list devicesSolidstate
M
73

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

Merci answered 20/11, 2017 at 13:56 Comment(5)
This is not the device IDValueless
Apple obviously distinguishes between Devices and Simulators (see Xcode > Window > Devices and Simulators [Devices|Simulators]) Above is the "Simulator Identifier". Since iOS does not let you obtain the "Device" ID any more, that's the best you can get for the practical use to investigate into a Simulator's resources and states. (I just explained the command line way)Merci
broken link. please fixEllison
Works. I wish this command showed the OS version as well running on the simulator like the instruments -s devices shows. Its a tradeoff.Transliterate
@GaneshS if you see my new answer, it provides you both the OS and the id.Accumulator
F
66

Try this

instruments -s devices
Folk answered 7/3, 2017 at 13:43 Comment(4)
looks like the brief version of xcrun simctl list I recommend the xcrun simctrl only if you need more information e.g. about the "booted" state (Open Window) of each simulator instance. Wrote a nice AppleScript to just reset those to their factory state (including Keychain).Merci
This is not 100% solution. It shows all simulator devices with uuid. It does not tell which devices is booted. Answer below by TiBooX shows which device is booted but again it does not tell the Operating system running on the simulator device.Transliterate
Thanks for sharing it. Worked for me :)Dessiedessma
Running instruments -s devices, it says instruments is now deprecated in favor of 'xcrun xctrace' --> xcrun xctrace list devicesSolidstate
A
28

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.

Accumulator answered 15/4, 2020 at 13:12 Comment(0)
C
21

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

Catamaran answered 9/5, 2014 at 17:31 Comment(0)
W
11

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

Wane answered 24/5, 2018 at 7:35 Comment(0)
W
3

"instruments" has been deprecated. Please use this command now:

xctrace list devices

Whimsicality answered 27/4, 2023 at 8:53 Comment(0)
M
0

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).

Miry answered 31/7, 2014 at 19:24 Comment(0)
G
0

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.

Gopak answered 15/10, 2018 at 8:19 Comment(0)
P
0

run command xcrun xctrace list devices in your terminal

Psilomelane answered 7/6, 2024 at 20:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.