GUIDE

How to test localhost in the iOS Simulator

Open your local development server in the iOS Simulator’s Safari, including HTTPS dev servers and pages that use location.

Updated October 2, 2026

The iOS Simulator runs on your Mac and shares its network. That means http://localhost:3000 inside the Simulator reaches the same development server as http://localhost:3000 in Safari on your Mac. No LAN IP addresses or tunnels needed.

1. Start your development server

Start it the way you normally do, for example npm run dev. Check that the page loads in Safari on your Mac first. If it doesn’t load there, it won’t load in the Simulator either.

2. Boot a Simulator

List the simulators you have installed:

xcrun simctl list devices available

Boot one by name or UDID, then open the Simulator app so you can see it:

xcrun simctl boot "iPhone 17 Pro"
open -a Simulator

If the list is empty, install an iOS Simulator runtime in Xcode → Settings → Components.

3. Open your page

You can type the address into Safari in the Simulator, or open it from Terminal:

xcrun simctl openurl booted http://localhost:3000

booted targets the simulator that is currently running. Right after a cold boot, the first openurl can time out while iOS finishes starting up. Wait a few seconds and run it again.

HTTPS development servers

If your dev server uses a locally generated certificate, the Simulator doesn’t trust it by default. Add the root certificate that signed it to the simulator’s keychain. With mkcert, for example:

xcrun simctl keychain booted add-root-cert "$(mkcert -CAROOT)/rootCA.pem"

Then reload the page. Each simulator has its own keychain, so repeat this for other simulators.

Pages that use location or other secure features

Browsers only allow features like geolocation on secure origins. localhost counts as secure even over plain HTTP, so http://localhost:3000 can ask for location. A LAN address such as http://192.168.1.20:3000 can’t, so stick with localhost in the Simulator. To choose which location the page sees, see setting a custom location.

Hot reload

Hot module reloading (Vite, Next.js, webpack and others) works as usual, because the Simulator reaches your dev server’s WebSocket over the same localhost.

With Device Helm

Choose a simulator, enter your localhost URL, and click Start Workspace. Device Helm boots the simulator, waits until it’s ready, opens the page (retrying if the first attempt times out), and arranges the windows. It doesn’t start your development server, so keep that running yourself.