How to run iPhone emulator WITHOUT starting Xcode?
Asked Answered
C

19

274

On my old Mac running Snow Leopard, I could type "ios" into spotlight and it would start up the iPhone/iPad emulator by itself.

I have since had to get a new machine running Lion. I have installed Xcode for Lion, I have installed the developer tool options from the preferences panel.

But the "ios" option is no longer there :( The only way now seems to be to run Xcode, create an empty project and then launch emulator with the run option.

I have searched and searched the internet and the Facebook, but nothing helps.

Does anyone know how to run only the emulator on Lion?

Update: In response to @ike_love thread below. that answer is not assured to work on all Yosemite machines.

enter image description here

Choker answered 30/4, 2012 at 6:53 Comment(1)
type "simulator" instead of "ios" ;)Fibroma
C
233

The easiest way without fiddling with command line:

  1. launch Xcode once.
  2. run ios simulator
  3. drag the ios simulator icon to dock it.

Next time you want to use it, just click on the ios simulator icon in the dock.

Cords answered 17/2, 2013 at 9:57 Comment(7)
This should have been accepted as the answer. The terminal commands mentioned in the accepted answer may change for a future version of OS X. But the suggestion mentioned in this answer is not likely to change over versions.Shoshonean
Ehm no, the title says explicitely without starting xcode. Then second point is, if you restart your mac the icon is gone...Subastral
If you want to work with the app itself, do what this post says but, right click the dock icon and "Show in Finder" to reveal the location of the app in Finder. The location of the app has recently changed since the accepted answer above.Lippold
yeah! this way also works fine with spotlight quick search as well +1!Pentha
What worked for me is a variation of this. With the simulator (and Xcode) running there is an icon for the simulator in the dock area. Right-click on that icon and select Options - Keep in Dock.Scintillant
Long press on the icon shows a popup and you can open from that. Simply clicking the dock icon did not work for meLoutish
When the question was first answered 8 years ago, it was the best answer. Things change. Updated to accept this answer.Choker
M
429

Assuming you have Xcode installed in /Applications, then you can do this from the command line to start the iPhone Simulator:

$ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app

(Xcode 6+):

$ open /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app

You could create a symbolic-link from your Desktop to make this easier:

$ ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app ~/Desktop

(Xcode 6+):

$ ln -s /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app ~/Desktop

As pointed out by @JackHahoney, you could also add an alias to your ~/.bash_profile:

$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/De‌​veloper/Applications/iPhone\ Simulator.app'

(Xcode 6+):

$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app'

(Xcode 7+):

$ alias simulator='open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app'

Which would mean you could start the iPhone Simulator from the command line with one easy-to-remember word:

$ simulator
Marozik answered 30/4, 2012 at 7:2 Comment(16)
echo "alias iphone='open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'" >> .bash_profile;. .bash_profileFreddafreddi
I had to use: $ open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.appBloodcurdling
@BrianWigginton Isn't that exactly what my answer says?Marozik
For the benefit of others, I had to use /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app , since Xcode is installed differently on this system.Spain
Searching for it in Finder and dragging it to the Dock is clearly the way to go.Solitary
@HenrikErlandsson Add a new answer to the question then. Your downvote seems a little unfair as the answer I provide will do as the OP asks...Marozik
@HenrikErlandsson If only I could down vote comments. :) That was the first thing I did and I couldn't find it.Choker
@Marozik your last trick i.e."$ simulator" not worked in maverick + xcode 5.1Fermi
@void-pointer it appears that it's now open -a "iOS Simulator", at least on Xcode 6.0.1Jackelinejackelyn
This should be updated per @daniel below: /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.appBozovich
@Jackelinejackelyn Yep, I just came back to this post after my Bash alias failed. I wish I could edit my comment =/ You may want to make that an answer.Nomenclature
It is now open -a "Simulator" and open -a "Simulator (Watch)" for, obviously, the watch :)Velma
Add open -n /Path/to/Simulator.app - Notice the -n flag. This will make sure a new simulator is launched.Brazee
I created an Automator app so you can launch the simulator from your dock easily github.com/tsdexter/ios-simulator-expo-utilitiesSade
@KewalShah I mention that in the first sentence?!?Marozik
@Marozik Ah sorry, missed it.Esperance
C
233

The easiest way without fiddling with command line:

  1. launch Xcode once.
  2. run ios simulator
  3. drag the ios simulator icon to dock it.

Next time you want to use it, just click on the ios simulator icon in the dock.

Cords answered 17/2, 2013 at 9:57 Comment(7)
This should have been accepted as the answer. The terminal commands mentioned in the accepted answer may change for a future version of OS X. But the suggestion mentioned in this answer is not likely to change over versions.Shoshonean
Ehm no, the title says explicitely without starting xcode. Then second point is, if you restart your mac the icon is gone...Subastral
If you want to work with the app itself, do what this post says but, right click the dock icon and "Show in Finder" to reveal the location of the app in Finder. The location of the app has recently changed since the accepted answer above.Lippold
yeah! this way also works fine with spotlight quick search as well +1!Pentha
What worked for me is a variation of this. With the simulator (and Xcode) running there is an icon for the simulator in the dock area. Right-click on that icon and select Options - Keep in Dock.Scintillant
Long press on the icon shows a popup and you can open from that. Simply clicking the dock icon did not work for meLoutish
When the question was first answered 8 years ago, it was the best answer. Things change. Updated to accept this answer.Choker
T
127

In XCode 7+ the location is now

/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

Run it from the command line

$ open -a Simulator
Tenderize answered 23/9, 2015 at 23:54 Comment(2)
$ open -a Simulator is the correct answer as of MacOS 10.14, XCode 10.1. Thanks!Bedizen
So /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator runs the simulatorConquer
A
70

From Terminal you have to run:

open -a Simulator
Annettaannette answered 16/10, 2019 at 19:43 Comment(0)
C
30

No need to do anything on the commandline.

Just use spotlight to run simulator.app

screenshot of spotlight searching simulator.app

Carrol answered 2/11, 2015 at 16:31 Comment(3)
You can do basically this same thing with Alfred alfredapp.comNashom
Spotlight on my machine (M1 Pro, Monterey 12.5) doesn't find this. It is there in /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/SimulatorWolters
This answer describes how to access it via Spotlight: https://mcmap.net/q/108231/-how-to-run-iphone-emulator-without-starting-xcodeWolters
P
24

is it helpful to you see the image enter image description here

Edit

Now with new Xcode if the icon of the Xcode is on dock you can just right click it and form the menu you can select Open Developer Tool and in the sub menu you can select the iOS Simulator to open the simulator without opening the Xcode.!enter image description here

Putandtake answered 30/4, 2012 at 7:2 Comment(1)
It's worth pointing out here, that Xcode still needs to be open and running in order to access this submenu. This submenu will NOT display, if Xcode isn't already running - which is what your answer implies.Camphorate
K
20

You can get it to launch via spotlight if you create an Automator launcher for it:

  1. Open Automator.app
  2. Choose type of Application
  3. Select Actions > Library > Utilities > Launch Application
  4. Open the dropdown of applications that can be launched and choose Other
  5. You can't directly select the Simulator app because it's inside the Xcode.app package. So instead you'll have to navigate to it in a separate Finder window and drag it onto the file selector window. It will be at one of the following paths depending on your version of Xcode (oldest to newest):
    • /Applications/Xcode.app/Contents/Developer/iOS Simulator.app
    • /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app
    • /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
  6. Finally, save this Automator app in your applications folder as iOS Simulator.app

Create Automator app

To get a nice icon for the Automator app you just made, you can do the following:

  1. Right click iOS Simulator.app and choose Get Info
  2. Click the icon in the upper left corner and do Cmd-C to copy it
  3. Right click your Automator app and choose Get Info
  4. Click the icon in the upper left corner and do Cmd-V to paste

Copy icon

Kermanshah answered 4/4, 2014 at 19:4 Comment(1)
Great idea, as it's also usable in Alfred and easy to find laterGradey
D
17

As the multitude of answers indicate, there are lots of different ways to address this issue. Not all of them address what is my number one issue, and what seems to be the asker's priority, as well: The ability to launch from Spotlight.

Here's the solution that works well for me, and should work with any OS X and XCode versions. I've tested it on OS X 10.11 and XCode 7.3.

Initial setup does require launching XCode, but after that, you won't need to just to get to the Simulator.

Setup

  1. Launch XCode
  2. From the XCode menu, select Open Developer Tool > Simulator
  3. In the dock, control (or right) click on the Simulator icon
  4. Select Options > Show in Finder
  5. While holding down Command and Option, drag the Simulator icon to the applications directory. This creates an alias to it.
  6. If desired, rename the alias from "Simulator" to "iOS Simulator". Whatever you name it is what it will show up as in Spotlight.

Note: There are other ways to get to the location of the Simulator app (steps 1-4), such as using Go to Folder… in the Finder, but those require knowing the location of the Simulator to begin with. Since that has changed from version to version of XCode, this way should work regardless of these changes.

Use

  1. Launch Spotlight (command-space, etc.)
  2. Type "simulator" or "ios" (if you renamed the alias).
  3. If necessary, use the down arrow to scroll to the Simulator alias. Eventually, spotlight should learn and make the alias the top choice so you can skip this step.
  4. Hit return
Denverdeny answered 21/4, 2016 at 17:9 Comment(4)
on Sierra, simulator can be found with spotlight without any special setup.Voncile
@johnywhy For some reason, Spotlight doesn't find Simulator for some people, including me on a fairly fresh Sierra install. I'd love to find out how to get it to find it, but in the meantime, these steps help.Denverdeny
This is the most consolidated answer and makes it available on Finder as well.Handicap
This was not available to me via Spotlight in a fresh install of High Sierra.Lindsylindy
D
13

With Xcode 6 the location of the simulator has changed to:

/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app

It can no longer be found here: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app

Darceydarci answered 22/9, 2014 at 8:36 Comment(0)
F
12

Try below instruction for launching iphone simulator:

Goto Application Folder-->Xcode app-->right click to Show Package Contents-->now show files in xcode contents-->Developer-->Platforms-->iPhoneSimulator.platform-->Developer-->Applications--> now show iOS Simulator app click to launch iphone simulator...!

Frayne answered 30/4, 2012 at 7:2 Comment(0)
P
10

The solutions above didn't work for me in ZSH. I needed to escape the dot in the iPhoneSimulator.platform. This works for me:

alias simulator="open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app"

This could be even more resilient version:

alias simulator="open -a 'iOS Simulator'"
Printmaking answered 25/9, 2013 at 9:1 Comment(2)
Thanks this do the jobEgeria
its not worked in x-code 5.1 + mavericks , but above tricks by @Marozik worked successfully...Fermi
B
9

There's a far easier way:

  1. Hit command + space, Spotlight Search will appear
  2. Type in iOS Simulator and hit return

Done.

----- In follow up to @E. Maggini downvote---

Yes you can still easily access iOS Simulator using Spotlight.

enter image description here

Bumpy answered 15/7, 2015 at 22:30 Comment(8)
The question states that ios will not show up when running spotlight. Your answer, in fact, does not work since OSX Lion.Choker
@E.Maggini, you are wrong. Above is a screenshot of iOS Simulator showing up in Spotlight using latest OS X Yosemite. So yes, in fact, my answer is correct and has been all along. If your OS X Lion does not show it, then there's something wrong with your OS X installation.Bumpy
Too bad I can't add a screen shot here, because on my Yosemite machine at work which has a completely different install from my old machine at home....still no iOS results. Either way, the question asks for a solution BESIDES this....so.....Choker
On my machine that is version 10.10.5 with xcode-beta(7.0), this answer does in fact work.Conformance
iOS simulator has been renamed to simply simulator. That's why it doesn't work anymore.Carrol
@Jean-FrançoisBeauchamp - On El Capital you type 'Simulator' and it works.Bumpy
this is the best answer, but type just simulatorVoncile
this should be the top answer lol - and yap, should edit answer so that it says simulatorGurule
E
8

In the terminal: For Xcode 9.x and above

$ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

For Xcode-beta 9.x and above

$ open /Applications/Xcode-beta.app/Contents/Developer/Applications/Simulator.app
Enshrine answered 12/7, 2017 at 9:53 Comment(0)
C
8

I know it is an old question, but this might help someone using Xcode11+ and macOS Catalina.

To see a list of available simulators via terminal, type:

$ xcrun simctl list

This will return a list of devices e.g., iPhone 11 Pro Max (6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE) (Shutdown). The long string of characters is the device UUID.

To start the device via terminal, simply type:

$ xcrun simctl boot 6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE

To shut it down, type:

$ xcrun simctl shutdown 6A7BEA2F-95E4-4A34-98C1-01C9906DCBDE

Alternatively, to launch a simulator:

open -a simulator

Source : How to Launch iOS Simulator and Android Emulator on Mac

Cageling answered 21/8, 2020 at 14:15 Comment(0)
T
5

The easiest way is to use Spotlight Search. Just click CMD+Space and type in search Simulator. Just like this:

enter image description here

And in few seconds emulated device will be loaded:

enter image description here

To switch to another device you can use menu under Hardware -> Device

There are few different cool instruments you can use under Hardware menu, such as orientation change, gestures, buttons, FaceID, keyboard or audio inputs.

Triable answered 28/5, 2019 at 6:57 Comment(0)
M
4
  1. Go into Finder.
  2. On the sidebar, click applications.
  3. Find Xcode in Applications.
  4. Right click Xcode by whatever settings you have (usually two finger click [not tap]).
  5. Click "Show Package Contents."
  6. Go into the Contents folder.
  7. Search simulator.
  8. Wait 30 secs for it to load.
  9. Scroll down and find iOS Simulator.
  10. You may drag this onto the dock for easier access.
Matriculate answered 19/9, 2014 at 22:44 Comment(0)
B
2

In case you were trying to open multiple distinct simulators at once:

Open the Simulator app, not Xcode.

Then File >> Open Device >> Select iOS version >> select device.

enter image description here

The location of the 'open device' has changed in different Xcode versions so it may be at a different place

Biotin answered 2/10, 2020 at 15:14 Comment(0)
S
1

I created an automator app based on @trojanfoe's answer so you can launch iOS Simulator directly from your Dock https://github.com/tsdexter/ios-simulator-expo-utilities/

Sade answered 6/8, 2019 at 15:40 Comment(0)
A
0

From Terminal just run this command:

ios-sim  start

Or,add this to your ~/.profile to save yourself a few keystrokes:

alias ios="ios-sim  start"

Not sure which version of Max OS X and Xcode this command became available. I'm running 10.10.3 and 6.3 respectively.

Allowed answered 17/4, 2015 at 2:59 Comment(1)
This is not a part of OS X but a phonegap utility: github.com/phonegap/ios-simSinful

© 2022 - 2024 — McMap. All rights reserved.