You can use the following commands with simctl to control and manage Xcode Simulator. For more details and options, you can run xcrun simctl help or xcrun simctl help <command> in the terminal.

  • list: List available devices, device types, runtimes, or device pairs.
    • Example: xcrun simctl list
  • create: Create a new device.
    • Example: xcrun simctl create "iPhone 12" com.apple.CoreSimulator.SimDeviceType.iPhone-12 com.apple.CoreSimulator.SimRuntime.iOS-14-4
  • delete: Delete a device or all unavailable devices.
    • Example: xcrun simctl delete C0D7F8B0-6B7A-4A1D-AF2C-8C6E7D2B0E7F
  • boot: Boot a device.
    • Example: xcrun simctl boot iPhone 12
  • shutdown: Shutdown a device.
    • Example: xcrun simctl shutdown iPhone 12
  • erase: Erase a device’s contents and settings.
    • Example: xcrun simctl erase iPhone 12
  • install: Install an app on a device.
    • Example: xcrun simctl install iPhone 12 /path/to/MyApp.app
  • uninstall: Uninstall an app from a device.
    • Example: xcrun simctl uninstall iPhone 12 com.example.MyApp
  • launch: Launch an app by identifier on a device.
    • Example: xcrun simctl launch iPhone 12 com.example.MyApp
  • terminate: Terminate an app by identifier on a device.
    • Example: xcrun simctl terminate iPhone 12 com.example.MyApp
  • spawn: Spawn a process by executing a given executable on a device.
    • Example: xcrun simctl spawn iPhone 12 /bin/ls /var/mobile
  • openurl: Open a URL in a device.
    • Example: xcrun simctl openurl iPhone 12 https://apple.com
  • addmedia: Add photos, live photos, videos, or contacts to the library of a device.
    • Example: xcrun simctl addmedia iPhone 12 /path/to/photo.jpg
  • io: Set up a device IO operation. For example, record video or take screenshots.
    • Example: xcrun simctl io iPhone 12 recordVideo /path/to/video.mp4
  • status_bar: Set or clear status bar overrides on a device. For example, change the time or battery level.
    • Example: xcrun simctl status_bar iPhone 12 override --time "9:41" --batteryLevel 100
  • privacy: Grant, revoke, or reset privacy and permissions for an app on a device. For example, allow access to camera or location.
    • Example: xcrun simctl privacy iPhone 12 grant camera com.example.MyApp
  • push: Send a simulated push notification to a device. For example, send an alert or badge update.
    • Example: xcrun simctl push iPhone 12 com.example.MyApp /path/to/push.json
  • icloud_sync: Trigger iCloud sync on a device. For example, sync documents or key-value store.
    • Example: xcrun simctl icloud_sync iPhone 12
  • rename: Rename a device. For example, change the name from “iPhone 12” to “My iPhone”.
    • Example: xcrun simctl rename iPhone 12 "My iPhone"
  • ui: Trigger UI appearance and disappearance notifications on a device. For example, simulate entering or exiting the background.
    • Example: xcrun simctl ui iPhone 12 background
  • keychain: Manage the keychains on a device. For example, add or delete a certificate or a key.
    • Example: xcrun simctl keychain iPhone 12 add-root-cert /path/to/cert.pem
  • get_app_container: Print the path of the installed app’s container. For example, get the path of the documents or data directory.
    • Example: xcrun simctl get_app_container iPhone 12 com.example.MyApp data
  • logverbose: Enable or disable verbose logging for a device. For example, show more details about the device events and actions.
    • Example: xcrun simctl logverbose enable
  • help: Print the usage and options for a given command or all commands. For example, get more information about the launch command.
    • Example: xcrun simctl help launch These are some of the most common and useful commands that you can use with simctl to control and manage Xcode Simulator. You can find more commands and options by running xcrun simctl help in the terminal.

Thanks for reading!