This article will tell you how to start an iOS simulator and Android simulator when you need to use them.
1. How To Start iOS Simulator On macOS.
1.1 Start iOS Simulator Using Command-Line.
- Open a terminal on macOS.
- Run the command xcrun simctl list to list all the available iOS simulators.
== Device Types == ...... iPhone 7 (com.apple.CoreSimulator.SimDeviceType.iPhone-7) iPhone 7 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-7-Plus) iPhone 8 (com.apple.CoreSimulator.SimDeviceType.iPhone-8) iPhone 8 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-8-Plus) iPhone X (com.apple.CoreSimulator.SimDeviceType.iPhone-X) iPhone Xs (com.apple.CoreSimulator.SimDeviceType.iPhone-XS) iPhone Xs Max (com.apple.CoreSimulator.SimDeviceType.iPhone-XS-Max) iPhone Xʀ (com.apple.CoreSimulator.SimDeviceType.iPhone-XR) iPhone 11 (com.apple.CoreSimulator.SimDeviceType.iPhone-11) iPhone 11 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro) iPhone 11 Pro Max (com.apple.CoreSimulator.SimDeviceType.iPhone-11-Pro-Max) iPhone SE (2nd generation) (com.apple.CoreSimulator.SimDeviceType.iPhone-SE--2nd-generation-) iPhone 12 mini (com.apple.CoreSimulator.SimDeviceType.iPhone-12-mini) iPhone 12 (com.apple.CoreSimulator.SimDeviceType.iPhone-12) iPhone 12 Pro (com.apple.CoreSimulator.SimDeviceType.iPhone-12-Pro) iPhone 12 Pro Max (com.apple.CoreSimulator.SimDeviceType.iPhone-12-Pro-Max) ...... == Devices == -- iOS 11.0 -- ...... iPhone 7 (E53A5FFC-62B7-4DF8-8AEB-0FFBECF266D7) (Shutdown) iPhone 7 Plus (60481755-2B2B-4530-B3DD-05892BA86681) (Shutdown) iPhone 8 (CB2ADDA5-706F-4B49-A305-A231239386D7) (Shutdown) iPhone 8 Plus (D28D7DB7-3580-4C8E-8545-21E788161CF8) (Shutdown) iPhone X (33BF8735-637F-43A0-BEFD-A3C898482868) (Shutdown) iPad Air (5301B213-BAEE-427C-90B1-24B6D58287D5) (Shutdown) iPad Air 2 (55C4978E-C380-4EFD-8D2C-1BC301501B34) (Shutdown) iPad Pro (9.7-inch) (95E66389-45C5-4589-B96C-39DD3678C179) (Shutdown) iPad Pro (12.9-inch) (B5D8BC68-67A3-4BEE-BB27-4FAFBAF99FD9) (Shutdown) iPad (5th generation) (0CED050E-C973-449C-8CD0-A29BF32CDF3B) (Shutdown) iPad Pro (12.9-inch) (2nd generation) (4E45877C-69A2-40B7-8374-2CC3F906B30C) (Shutdown) iPad Pro (10.5-inch) (1821925A-35BF-4A09-8A75-C611EA0B024D) (Shutdown) -- iOS 12.0 -- ...... iPhone 7 (00C31389-2738-4A3A-822E-86D92ADC5C68) (Shutdown) iPhone 7 Plus (0E7DD54B-3E1E-4A3A-856E-78AC323715C6) (Shutdown) iPhone 8 (FDB318BC-C823-4C0A-817D-168C9ABB3EC3) (Shutdown) iPhone 8 Plus (ADC6BA4B-C94B-4073-A4DD-E16EF7449BAB) (Shutdown) iPhone X (78FCF2C5-841B-4E08-B043-8F492A3E886D) (Shutdown) iPhone XS (AA1D5775-E19E-46B5-A2AD-C55AF544552E) (Shutdown) iPhone XS Max (50D1E6E9-6C08-45B3-8731-587649883AFB) (Shutdown) iPhone XR (0CAFB5E2-4720-49B2-BACE-7D12222F40B7) (Shutdown) iPad Air (44370A71-354C-433D-B3A0-519BB4295135) (Shutdown) iPad Air 2 (DF325775-6C55-4D57-899E-D4FD8C77F628) (Shutdown) iPad Pro (9.7-inch) (C7E77F33-2D30-4738-93D1-012D7E27D88B) (Shutdown) iPad Pro (12.9-inch) (CC0C1AC7-D156-41AB-B9A7-64195B88A295) (Shutdown) iPad (5th generation) (69887022-F23E-49A5-936B-CE66649A2627) (Shutdown) iPad Pro (12.9-inch) (2nd generation) (155761E1-A7B6-4813-B70D-255DA2B4EA9B) (Shutdown) iPad Pro (10.5-inch) (52AD419A-A7DC-4E15-AFD8-E507EA6831E7) (Shutdown) iPad (6th generation) (9BB50F58-CCA4-41A1-B583-B1C6B0B2C939) (Shutdown) -- iOS 14.4 -- iPhone 8 (A48B7143-4348-425E-9DB0-7F2B5E55F3CE) (Shutdown) iPhone 8 Plus (7650B055-1F87-4F5C-8EDF-888E3E823276) (Shutdown) iPhone 11 (339061C5-9164-4116-BF37-AE715CBBE8EC) (Shutdown) iPhone 11 Pro (B1A67458-1FB1-4390-B2E6-6EEFFC0D10FB) (Shutdown) iPhone 11 Pro Max (19E2D57B-523B-4176-A8E2-81DD43463B5D) (Shutdown) iPhone SE (2nd generation) (42A4B94E-24B3-47AE-AD93-CB0214C83255) (Shutdown) iPhone 12 mini (25CB6A74-BB44-48AD-AF3D-782F862CFF69) (Shutdown) iPhone 12 (835E9381-2561-421C-BFE4-A89C8FB37B65) (Shutdown) iPhone 12 Pro (75E82032-BAF6-4556-A8DB-6CEA2551A4F8) (Shutdown) iPhone 12 Pro Max (57A778F5-7DFF-4821-9E1E-4055B7240771) (Booted) ...... -- tvOS 14.3 -- ...... Apple TV (FCF7C31D-7DEA-4F83-8263-4067650B19A3) (Shutdown) ......
- Then you can start one simulator by running the below command open -a Simulator –args -CurrentDeviceUDID <device-id>.
open -a Simulator --args -CurrentDeviceUDID B1A67458-1FB1-4390-B2E6-6EEFFC0D10FB
- You can find the <device-id> from the above device list, for example from the line iPhone 8 Plus (ADC6BA4B-C94B-4073-A4DD-E16EF7449BAB) (Shutdown), we can see the device-id is ADC6BA4B-C94B-4073-A4DD-E16EF7449BAB.
- If you want to start the recently used iOS simulator, you can run the command open -a Simulator.app or open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app.
$ open -a Simulator.app or $ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
- If you want to install your iOS app on the simulator, you can run the command xcrun simctl install <your device UDID> <path to application bundle> to install it.
- Then you can run the command xcrun simctl launch <your device UDID> <app bundle identifier> to start the iOS simulator with the iOS application.
1.2 Open iOS Simulator From Xcode.
- Start Xcode editor, you do not need to create or open any Xcode project.
- Click the Xcode —> Open Developer Tools —> Simulator menu item on the top left corner of the Xcode editor.
- Then you can find the simulator app on the bottom docker bar.
- Right-click the Simulator icon on the docker, click the Device menu item on the popup menu list, then it will show the iOS versions list on the popup list.
- Select the iOS version that you want to run on the simulator, then it will list all the iOS simulators that support the selected iOS version.
2. How To Start Android Simulator.
- Get Android SDK install directory path, you can refer to the article How To Set Android SDK Path In Windows And Mac.
- On windows, the Android SDK installed path is usually something like C:\Users\<user-name>\AppData\Local\Android\Sdk.
- Open a terminal and go to the Android SDK tools directory by running the command cd C:\Users\<user-name>\AppData\Local\Android\Sdk\tools.
- Run the command emulator -list-avds to list all the installed Android emulators’ names.
>emulator -list-avds Nexus_S_API_31
- To start the Android emulator, just run the command emulator -avd <emulator-name> in the Android SDK tools directory.
emulator -avd Nexus_S_API_31
- You can manage the Android emulator in the Android Studio, you can read the article How To Create Android Virtual Device (AVD) In Android Studio to learn more.