Skip to content

Devices and runtimes

iOS Simulator

Capture and decrypt traffic from iOS, tvOS and watchOS Simulators, and install the Cloak Proxy certificate in every booted simulator with one click.

Simulators are the quickest way to debug an iOS app’s network calls. iOS, tvOS and watchOS Simulators use your Mac’s network settings, so their traffic is captured whenever the macOS proxy is on. Each simulator keeps its own trusted certificates, though, so it needs the Cloak Proxy certificate installed once before HTTPS can be decrypted.

  • Xcode, installed and selected as the active developer directory. The one-click install uses simctl, which comes with Xcode.
  • At least one simulator booted (running) when you install the certificate.
  • The macOS proxy on, so the simulator’s traffic goes through Cloak Proxy. See macOS traffic.

If simctl isn’t available, the iOS Simulator tab shows: This needs Xcode (simctl isn’t installed). Install Xcode from the App Store, then run sudo xcode-select -s /Applications/Xcode.app.

The iOS Simulator tab on a Mac without Xcode. With Xcode installed, the warning is replaced by the install button.

  1. The iOS Simulator tab
  2. Shown when simctl isn't found; install Xcode and select it
The iOS Simulator tab explaining that simulators use the Mac's network settings, with an orange warning that Xcode and simctl aren't installed
Terminal
sudo xcode-select -s /Applications/Xcode.app

Cloak Proxy checks for simctl each time you open the tab, so switch to another tab and back after you install Xcode.

  1. Boot the simulators you want to use. Open them from Xcode or the Simulator app.

  2. Open Device & Runtime Setup (click Devices in the toolbar) and choose the iOS Simulator tab.

  3. Click Install Certificate on All Booted Simulators.

    Cloak Proxy runs this command with the path of its root certificate:

    Terminal window
    xcrun simctl keychain booted add-root-cert "$HOME/Library/Application Support/CloakProxy/cloak-proxy-ca.pem"
  4. Read the result below the button:

    • Installed. Restart the app in the simulator. The certificate is trusted. Quit and reopen your app so it picks up the change.
    • simctl: no booted simulator? No simulator was running. Boot one and click the button again.
    • simctl: followed by other text is the error simctl reported.
  5. Turn on the macOS proxy if it’s off: click macOS Proxy in the toolbar or press ⇧ ⌘ P.

You don’t need to set a proxy inside the simulator or turn on Allow other devices to connect. The simulator’s requests come from your Mac itself, the same way any other Mac app’s do.

To install the certificate on one particular simulator while several are booted, run simctl yourself with that simulator’s UDID. List the UDIDs first; booted simulators are marked (Booted).

Terminal
xcrun simctl list devices
xcrun simctl keychain <UDID> add-root-cert "$HOME/Library/Application Support/CloakProxy/cloak-proxy-ca.pem"

To print the certificate’s path from a script, use cloakctl ca. See cloakctl.

Installing the certificate makes decryption possible. Cloak Proxy still decrypts only the hosts in SSL Proxying, or the apps you turned SSL Proxying on for. Add your API’s host, for example api.example.com, then repeat the request in the simulator.

  1. Turn off the macOS proxy when you no longer want to capture (⇧ ⌘ P). Simulators then connect directly again.

  2. To remove the certificate from a simulator, reset its keychain or erase it:

    Terminal
    xcrun simctl keychain booted reset

    Resetting removes every certificate you added to that simulator’s keychain, not only Cloak Proxy’s. Device › Erase All Content and Settings in the Simulator app removes everything.

If you regenerate the root certificate in Settings › Certificate, simulators that trusted the old one need the new one installed. Click Install Certificate on All Booted Simulators again.