Build and run your app

Build and run your code to compile, link, and debug it. For products that can be run directly, if the product builds successfully, Xcode runs the product and starts a debugging session.

Xcode toolbar showing the scheme menu, run button, stop button, and activity view.
  1. Optionally, select an active scheme and destination from the scheme menu in the toolbar.

    For iOS, watchOS, and tvOS apps, choose a run destination from the Scheme menu.

    Run in a simulator: Under iOS Simulators, choose a device family or click Add Additional Simulators to configure your own. For tvOS apps, choose Apple TV 1080p. For watchOS, choose the WatchKit App as the scheme, and choose an iPhone simulator paired to an Apple Watch as the run destination.

    Build using the platform SDKs: Under Build Only Device, choose a generic device. Choose a generic device if later you want to create an archive of your app and you don’t have a real device. You can’t create an archive of a simulator build.

    Launch on a device: Under Device, choose a device connected to your Mac.

  2. Click the Run button to build and run your code with the active scheme.

    The activity view shows the build progress and results. (If the device is not registered, click Register Device in the sheet that appears.)

    Optionally, press the Run button to see other run options, or Option-click the Run button to open the Scheme editor and check or modify your settings before starting the build. Click the Run button in the Scheme editor to start building and running your code, or click the Close button to apply any changes without building.

  3. Use the Stop button to stop an in-progress build or end the current debugging session.

Xcode displays any errors or warnings it encounters in the Issue navigator. If there are errors during the compilation or link phase, Xcode does not run your code.

SEE ALSOChoose the action performed by the Run buttonAbout the Archives organizerSigning workflowPair Apple Watch simulators to iPhone simulatorsCreate a simulator configurationSimulator User Guide