User Agents

Remote Debug iOS Safari Web Pages: Step-by-Step

Remote debugging lets you inspect and debug web pages running on an iPhone or iPad directly from your computer’s browser. You can view the DOM, edit CSS live, run JavaScript in the console, monitor network requests, and see console errors — all from a desktop-sized screen with full DevTools. This guide walks you through the entire setup, from enabling the hidden Web Inspector feature to connecting and debugging your first page.

What You'll Need

  • A Mac running macOS (Safari’s Web Inspector only works with a Mac; Windows and Linux are not supported).
  • An iPhone or iPad with iOS 14 or later (earlier versions work too, but the steps are nearly identical).
  • A USB cable to connect the device to the Mac (or a shared Wi-Fi network for wireless debugging).
  • The latest version of Safari on both devices (update via System Settings/Software Update).

Step-by-Step

  1. Enable Web Inspector on your iPhone/iPad: Open the Settings app. Tap Safari (or Apps using Safari in newer iOS versions). Scroll down to the Advanced section and tap it. Toggle on Web Inspector. If you don’t see it, make sure you’re looking at the right Safari settings — it’s usually at the very bottom.
  2. Enable the Develop menu on your Mac: Open Safari on your Mac. In the menu bar, click Safari → Settings (or Preferences in older macOS). Go to the Advanced tab. At the bottom, check the box that says Show features for web developers. You’ll now see a new Develop menu in the Safari menu bar.
  3. Connect your device: Use a USB cable to connect your iPhone/iPad to your Mac. If prompted on the device, tap Trust This Computer and enter your passcode. For wireless debugging, make sure both devices are on the same Wi-Fi network and that you’ve enabled Remote Automation (in Settings → Safari → Advanced) — but USB is more reliable for the first try.
  4. Open the page you want to debug on your iPhone: Launch Safari on your iPhone and navigate to the web page you want to inspect. Keep that tab open.
  5. Access the Develop menu on your Mac: In Safari on your Mac, click the Develop menu in the menu bar. You’ll see a list of connected devices (e.g., “iPhone” or “iPad”). Hover over your device name, and a submenu will appear showing all open Safari tabs on that device.
  6. Open Web Inspector: Click the tab you want to debug. A new window (or a separate pane) will open in Safari on your Mac, displaying the Web Inspector for that page. You’ll see the DOM tree, the console, and other panels just like in desktop DevTools.
  7. Start debugging: Use the Elements (or Inspector) tab to inspect and edit HTML/CSS live. Use the Console tab to run JavaScript or view errors. The Network tab shows all resource requests. Changes you make in the inspector are reflected immediately on the iPhone — but they are temporary and reset on page reload.
  8. Disconnect safely: When you’re done, close the Web Inspector window and unplug the USB cable. You can leave Web Inspector enabled on your iPhone; it won’t affect normal browsing.

Common Mistakes

  • Web Inspector is greyed out or missing: This happens when the iPhone’s Safari settings haven’t been changed, or the device isn’t trusted. Double-check that you toggled Web Inspector on and that you tapped “Trust” on the iPhone.
  • Device doesn’t appear in the Develop menu: Often caused by using a charge-only USB cable. Try a different cable that supports data transfer. Also, make sure the iPhone is unlocked and on the home screen.
  • Develop menu is not visible on Mac: You forgot to enable “Show features for web developers” in Safari’s Advanced settings. Restart Safari after enabling it.
  • Debugging a page that uses service workers: Service workers may cache old versions of your page. Use the “Disable Caches” option in the Develop menu (or in the Network tab) to ensure you’re debugging the latest code.
  • Confusing the iPhone’s Safari with an in-app browser: Web Inspector only works with Safari. If you’re testing a page inside another app (like Facebook or Twitter), it won’t appear in the Develop menu. Open the page directly in Safari.

Tips

  • Use wireless debugging for convenience: Once you’ve connected via USB at least once, you can enable wireless debugging in Xcode (or via the Develop menu) to debug over Wi-Fi. This is handy if you need to move around.
  • Pin the Web Inspector window: You can undock it or dock it to the bottom of the Safari window. Use the layout buttons in the top-right of the inspector to switch between a separate window and a split view.
  • Take advantage of the “Responsive Design Mode” on Mac: While not a substitute for real device debugging, Safari’s Develop → Enter Responsive Design Mode lets you simulate iPhone screen sizes. But remember, it doesn’t emulate the actual iOS browser engine.
  • Use the “Elements” tab to test CSS changes quickly: Double-click a property value to edit it live. You’ll see the change on the iPhone instantly — great for fine-tuning layouts.
  • Clear site data to test fresh: If you’re debugging a persistent issue, go to Safari on the iPhone and clear website data (Settings → Safari → Clear History and Website Data) to rule out corrupted cache.

Troubleshooting

Device not showing in Develop menu: First, check the USB cable and port. Restart both Safari on the Mac and Safari on the iPhone. If that fails, go to Settings → General → Transfer or Reset iPhone → Reset → Reset Network Settings (this won’t erase data, but it will reset Wi-Fi passwords). Then reconnect.

Web Inspector opens but is blank: This can happen if the page is still loading or if the iPhone is locked. Unlock the iPhone and keep the page open. If it persists, reload the page on the iPhone.

Console shows no logs: Make sure you’re looking at the right console context. In the Web Inspector, there’s a dropdown at the top that lets you select the page or any iframes. Also, some iOS versions require you to enable “Logging” in the Develop menu (Develop → Experimental Features → Enable Logging).

Changes in Elements aren’t reflected on the iPhone: Live editing only works if the Web Inspector is connected. If you close the inspector, changes stop. Also, ensure you’re not editing a pseudo-element (like ::before) that might not update visually until you refresh.

Can’t see the Develop menu at all: If you’re on macOS Ventura or later, Safari’s settings are under Safari → Settings. If you’ve enabled the checkbox but the menu still doesn’t appear, quit Safari completely (Cmd+Q) and reopen it.

Frequently Asked Questions

Can I debug iOS Safari on a Windows PC?

No. Apple’s Web Inspector only works with Safari on macOS. On Windows, you can use remote debugging with Chrome for Android, but not for iOS.

Do I need Xcode to remote debug?

No, Xcode is not required for basic Web Inspector. You just need Safari on Mac and the Web Inspector toggle on the iPhone. Xcode is only needed for wireless debugging setup via the Devices window.

Can I debug a page that is not in Safari, like in a WebView inside an app?

Yes, but only if the app’s WebView has the WKWebView inspector enabled. For apps you don’t control, this is usually disabled. For your own apps, you can enable it in the app’s Info.plist.

How do I debug a page that is only accessible on a local network (like localhost)?

You can’t access localhost from the iPhone directly. Instead, run a local server on your Mac and use your Mac’s IP address (e.g., http://192.168.1.10:3000) on the iPhone. Make sure both devices are on the same network and your firewall allows incoming connections.

Why does my JavaScript breakpoints not hit?

Breakpoints in the Web Inspector work, but they may not hit if the page is using service workers or if the script is loaded from a different origin. Try disabling service workers in the Develop menu (Develop → Service Workers → Disable) and reload.

Can I use Chrome DevTools to debug iOS Safari?

Not directly. You can use the Safari Web Inspector, or you can use the ios-webkit-debug-proxy (open-source) to expose the Web Inspector protocol to Chrome DevTools, but that requires additional setup and is less stable.