As the mobile device market expands and looks set to increase exponentially, and with the current enthusiasm around responsive design, it is no longer an option for web developers to test just for the desktop. Using Apple’s iOS devices is probably a good start, but obtaining an army of iPhones and iPads of differing specifications just for this purpose is not practical for everyone.
If you have access to a Mac, however, there is a simple, reliable and free way of doing this without leaving OS X. In this post I’ll show you how.
Note: Since this post was first published, there have been some fundamental changes to how the simulator is obtained. This post has been updated to reflect those changes.
The iOS Simulator
Apple’s Developer Suite, which is used to create applications for OS X and iOS, comes with an excellent iOS Simulator, which in turn runs a fully functioning version of Mobile Safari. With it you can test how your pages look and work using the iOS screen dimensions and orientation, rendering, and you can see whether your CSS @media queries are being called. The following instructions show how to get hold of it.
Requirements
You’ll need a Mac running Mac OS X 10.6 (Snow Leopard) or above. A fast and ‘Unlimited’ internet connection is also recommended, since the download is pretty huge.
Obtaining the Simulator (Snow Leopard)
Register As An Apple Developer
To download the iPhone simulator requires you to download the entire development suite. To do this you must first register with Apple as a developer. There are different registration options, with different pricing plans, but if you aren’t planning to develop your own actual apps to upload to the app store, you can choose the free option.
Click on the following link http://developer.apple.com/programs/register/ and click on the blue ‘get started’ button:

Go through the registration process. If you already have an Apple ID, perhaps from using iTunes, then you can skip a few steps.
Download the SDK
Once registered, you will be given access to the main Apple Developer website. Paste the following link into your browser address bar. You may need to log in using the details you have just set up.
https://developer.apple.com/downloads/
You will be presented with a huge list of downloads. Search for ‘Xcode’, then scroll down to entries dated around April 1st, 2011. You should find a link to download Xcode 3.2.6. and iOS SDK 4.3 for Snow Leopard:
Click on the ‘download’ link as indicated. You will then jump to the following section. Click on the ‘XCode and iOS SDK’ link to download the disk image. It’s several Gigabytes so you’ll have a bit of a wait before the next step.
Obtaining the Simulator (Lion+)
As of Lion, you can download the iOS SDK free from the Mac App Store. Once again, it is pretty big so you’ll need to put some time aside.
Install the SDK and Locate The Simulator Application (Snow Leopard)
Once the SDK is installed, you will find the simulator tucked away deep within a series of directories. The path to it is:
HD > Developer > Platforms > iPhone Simulator Platform > Developer > Applications >
Once found, you can either make an alias to it or place it in your Dock for easy access.
Install the SDK and Locate The Simulator Application (Lion+)
As of version 4.3.2 of Xcode, the simulator is actually housed within the Xcode application bundle.
To get to it you must CTRL-click on the application icon, then select ‘show package contents’ from the menu that appears. This allows you to navigate through the internal directories of the application to find the simulator. The required path is:
Contents > Developer > Platforms > iPhoneSimulator.platform > Developer > Applications > iOS Simulator.app
Again, creating an alias in the dock is probably a good idea.
Using The Simulator
Launching the simulator will launch by default as an iPhone. From here you can open Mobile Safari and start browsing the web:

What is really great about this is that you can also connect to a MAMP install and view webpages running on your local host.
If you have any mobile specific CSS media queries these will be called.
Pressing Command and the left and right arrow keys will rotate the orientation of the simulator by 90 degrees so you can see how the page looks both in portrait and landscape mode.
Clicking on the screen with the cursor simulates touch events and dragging with the mouse does what you’d expect. Behaviour is pretty close to the real thing.
By holding Option/Alt you can even simulate a pinch/zoom gesture to preview page zooming.
Visiting the ‘Hardware’ menu gives you further options. Here you can change the simulated device and iOS version. With the device submenu you can choose between the iPhone and the iPad. The latest version gives you the choice between standard and retina versions too, great for checking that your -webkit-min-device-pixel-ratio: 2 media queries are being picked up:

The retina versions don’t really fit too well on lower resolution displays, so thankfully you can change the size of the simulator window using the Window > Scale menu:
Unfortunately, you can’t connect to the app store and start downloading Angry Birds, but then you can’t have everything…
Conclusion
Although Apple states that there are subtle differences between the simulator and the actual hardware (it is a ‘simulator’ after all and not an ‘emulator’) this is the closest you are going to get to the real thing without leaving OS X.
The ability to view draft pages on a local host without needing to upload to a remote server tips it for me, as this is not possible usual an actual handset and is really handy in the early stages of development. Quickly being able to test CSS media queries is another boon.
If anyone knows of similar solutions for other mobile platforms, or a way of doing this in Windows, feel free to leave info in the comments.




May 25, 2011 at 9:17 pm
thank yew
July 25, 2011 at 9:55 am
You wrote
“you can test how your pages look and work using the iOS screen dimensions and orientation, rendering, and you can see whether your CSS @media queries are being called.”
But Today I tried iOS simulator for testing but I think CSS media queries doesn’t work with Simulator.
I tried this demo http://www.webdesignerwall.com/demo/media-queries/ and Simulator doesn’t detect media queries.
Am i doing something wrong
My OS is Mac OS X 10.6.8 with Latest iOS SDK. I downloaded yesterday.
July 28, 2011 at 11:44 pm
Yes, tried that demo and it does behave a bit weirdly in the simulator, it picks up the max-device-width query but seems to get confused with the others.
If you try other live website examples however, such as Jon Hick’s http://hicksdesign.co.uk/ they seem to call the queries fine. My guess is that Nick La’s demo is at fault, although couldn’t be sure about that.
Media queries definitely should work in the simulator though.
I’m using Version 4.3 (238.2) of the simulator, a stable release, not any of the new betas.
August 11, 2011 at 11:09 am
This online simulator successfully spoofs an iphone user agent and lets you test mobile website in your desktop browser.
transmog.net
It’s free, quick and simple and works like a charm!
September 9, 2011 at 6:37 pm
I’m curious to know, does the simulator allow you to test other iOS apps like Mail ?
I have clients that have iPhones… and I must be the last man on the planet without one, but, if I could use the simulator, maybe it could be enough to let figure out my way with it and test SMTP settings, among other things.
September 12, 2011 at 11:33 pm
Hi Louis,
no, the simulator only includes Safari, the Photo, Contacts and Game Center apps, plus a stripped down version of Settings. It’s main purpose is for testing apps that you have created yourself in XCode, although I’m not sure of Apple’s rationale for including the apps they have and why other potentially useful ones (such as Maps for example) are omitted.
As for your dilemma, the cheapest answer is probably to get hold of a second-hand 3GS handset and a pay as you go SIM
November 5, 2011 at 9:36 pm
If you are looking to test emails, I would recommend EmailOnAcid.com. I have used their site to get up to speed on email client compatibility. @media queries may also be used within some email clients as swll. Pretty sweet.
September 20, 2011 at 6:34 am
Nice post, thanks for posting great information, I will try it
February 8, 2012 at 4:44 pm
Very nice post man, many thanks ;)
April 4, 2012 at 5:24 pm
I see instructions similar to this on many sites.
My problem is that I do not have a “/Developer” folder on my computer. It’s just not there. No matter how hard I stare and wish it were so it just isn’t :)
I did install xCode 4.3.2 on Lion and I went to Preferences -> Downloads and installed the iOS simulator.
However, “/Developer” just plain-old-still-isn’t-there no matter what I do.
Searching for “iphone simulator” in spotlight shows nothing relevant. I even searched for “simulator” and I still get nothing.
Are these (and maybe ever other instructions I can find) perhaps not for Lion and/or not for the latest version of xCode?
I’m not having luck on any other sites. They all tell me to look in “/Developer/.…” which is about as good as me looking for the Easter Bunny on Christmas day on Mars. It’s just not there.
April 4, 2012 at 5:51 pm
Hi Jason. Since Xcode 4.3.2, everything is installed within the Xcode application bundle, which is placed in the applications folder, there is no developer folder anymore. To find the iPhone simulator, Ctrl click on the Xcode app, and select ‘show package contents’. From here you can then navigate through the application bundle to the simulator.
April 11, 2012 at 6:03 pm
I wish Apple would bundle the iOS simulator on its own, without having to download and install the entire 4+GB Xcode package. I use it mainly for testing mobile websites, (not apps) so Xcode isn’t necessary for me — I’m sure I’m not the only one.
May 16, 2012 at 12:30 am
You are not the only one.
:-/
April 13, 2012 at 8:36 am
You can use pinch gestures in the iOS simulator to zoom in and out by holding down the option/alt key.
April 16, 2012 at 12:51 am
Thanks for the info @Transmedia, I discovered that very fact myself only recently. Have updated the post.
June 8, 2012 at 1:30 pm
James,
thanks for the info about the simulator being in the developer tools package, perhaps you could update your main post with that titbit as well