Stoutie
Stoutie

Reputation: 1994

Xcode 6 - How to Open Url in IOS Simulator Mobile Safari from Terminal?

I recently updated to Xcode 6 and now the command I was using before doesn't work:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/Applications/MobileSafari.app/MobileSafari -u "http://google.com/"

I do a lot of front end work and responsive design and must look at the results in every browser multiple times a day. It is very painful without this command.

Also, I would like to open in IOS7 with one command and IOS8 with another.

Upvotes: 10

Views: 15242

Answers (1)

Jeremy Huddleston Sequoia
Jeremy Huddleston Sequoia

Reputation: 23623

xcrun simctl openurl <Device UDID> http://www.google.com

You can determine the Device UDID by running xcrun simctl list or on newer versions, you can use "booted" instead of the UDID to refer to the currently booted device:

xcrun simctl openurl booted http://www.google.com

Note that this requires the iOS Simulator to actually be running. Depending on the version of Xcode.app that you have, you may be able to use the "booted" alias instead of the device UDID to select the currently booted device.

You may also want to look at Xcode 6 - Launch simulator from command line for information about how to launch the iOS Simulator app and have it start a specific device.

Upvotes: 23

Related Questions