Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS Unused CSS Stages Media Queries Device-Specific Media Queries: Part 1

iPhone simulator

Hello,

I am working on a mac and I would like to know how to launch the iPhone simulator as it is done in the video "Device-specific media queries: Part 1" of the "Media Queries" Depp Dive.

Thank you Michael

3 Answers

Chris Shaw
Chris Shaw
26,676 Points

Hi Michael,

The first thing you will need to do is download Xcode from the Mac App Store which is free but is a chunky download so it may take some time to download depending on your internet speed, once it's downloaded it should install automatically.

Once it's installed complete the following tasks.

  1. Open a new terminal window which you can do by typing Terminal into spotlight.

  2. Type in the command under the heading below and press enter.

  3. Open Safari on the simulator and enter the web address, please note that local paths do work as well, for example /Users/<your username>/Projects/mysite/index.html will work in the simulator.

Command to open the iPhone simulator

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

If you need to change the device or orientation simply refer to Apple's iOS simulator documentation which has a lot of information.

Tommy Gebru
Tommy Gebru
30,164 Points

Hey Chris, do you see the bug? the line of code or command you typed out has spilled out from the post and onto the column to the right outside of the forum post.

Chris Shaw
Chris Shaw
26,676 Points

Teame Gebru Fixed, I'm on a 1600px+ display so I didn't see that, thanks for spotting it.

Chris your a genius man you should just work for treehouse you know all the answers.

Hi Chris, and Teame!

Thanks a lot for your help, I got it!

Michael

Chris Shaw
Chris Shaw
26,676 Points

You're welcome

open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app The file /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app does not exist.

I tried to put it into Terminal but all I got was this!! Can't figure out why??

Chris Shaw
Chris Shaw
26,676 Points

You need Xcode before you can use the simulator, you can download it from the Mac App Store for free.