Setting up mobile simulators for android and IOS on Mac...
Iam going to write about how can you setup development simulators for both android and ios on your mac machine.
First of all, for android it as an emulator and for IOS its a simulator. There are some differences between the two; the high level difference being that emulator also kind of mimicks the hardware architecture of the real device while the simulator does not. You can read more about this on this stack overflow thread.
1. You need XCODE which actually has your simulator program inside it.
Download it from here or directly from the apple store
2. When the download is finished you can run your simulator by running the following command -
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator .platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator
3. You dont need to type in this command everytime. You can create a bash file and put the command inside it.
4. Open vi and copy paste the following text
#!/bin/sh
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator .platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator &
Give the file a name - (i've given mine iossim)
5. Save the file in some location. I generally store this file under /Users/bin/aseem
6. You can then input the above folder location in your PATH variable which is in ~/.bash_profile
7. Prefix the PATH variable with /Users/aseem/bin:
8. Open terminal again and type iossim and voilà your simulator is up and running.
1. Go here - https://developer.android.com/sdk/index.html#download
2. Click "Download the SDK tools for MAC." under "Use an existing IDE."
3. Once its downloaded; put the folder location in the PATH variable till the tools folder in .bash_profile
e.g /Users/aseem/Downloads/apps-raw/android-sdk-macosx 2/tools should be in your PATH variable
4.Open terminal again and enter android.
5. A window will open. Select the platform you want the emulator for.
For e.g for 2.3 select "SDK platform" under "Android 2.3" and install it.
6. Once its installed; next you will have to create a configuration for that platform to run.
7. This command will list all the platforms installed
android list targets
8. Run below command to create a configuration.
name: any name you want to give the configuration.
id: the id of the platform that comes when you list targets using 7.
android create avd -n <name> -t <id>
9. Once done, launch the emulator by running below command
emulator -avd <configname>
10. Similarly you can install platform for other android versions, create a configuration and run it.