How to Build and Run in Xcode (Cmd+R)
Mac: Cmd+R
Cmd+R compiles the currently selected scheme's target and launches it on whichever Simulator or connected physical device is selected in the scheme dropdown at the top of the Xcode window — the single most repeated action during any active development session.
**What happens during the build phase**: Xcode compiles every source file that's changed since the last build (and anything depending on those changed files), links the resulting object code into an executable, and for device builds, code-signs the app using your selected development team's certificate and provisioning profile before installing it.
**Simulator versus physical device targets**: running on the Simulator requires no code signing and installs near-instantly for small projects, making it the default choice for most day-to-day iteration, while running on a physical device requires a properly configured Apple Developer account, a valid provisioning profile, and the device to be registered and trusted — a meaningfully heavier setup that's necessary specifically for testing hardware features the Simulator can't fully replicate, like camera input, certain sensors, or accurate performance characteristics.
**What causes a Cmd+R press to fail before even launching**: a compile error anywhere in the currently building target stops the process entirely, with Xcode highlighting the specific error location in the editor and the Issue Navigator — no partial or best-effort launch happens if the code doesn't compile cleanly.
**The debugger attaches automatically**: unless explicitly configured otherwise in the scheme's Run settings, LLDB (Xcode's debugger) attaches to the launched process automatically, meaning breakpoints set anywhere in your code will pause execution as expected without a separate manual step to enable debugging.
**Related shortcuts**: Cmd+B for a build-only check without launching, Cmd+. to stop a running app, and Cmd+\\ to toggle a breakpoint before running if you already know where you want execution to pause.
**Why the scheme selector matters before pressing Cmd+R**: the scheme dropdown at the top of the window determines both which target actually builds and which Simulator or device it launches on, and this selection persists silently across sessions until manually changed — a stray Cmd+R after switching context earlier in the day can launch on a device or target you no longer intended, which is worth a quick glance to confirm before relying purely on muscle memory for this shortcut.
**Incremental builds versus a full rebuild**: most Cmd+R presses only recompile files that have actually changed since the previous build, which is why repeated runs during active iteration feel fast — Xcode's build system caches unaffected object files rather than recompiling the entire project from scratch every single time, reserving a full from-scratch rebuild for Clean Build Folder specifically.
**What a failed launch actually looks like**: if the build itself succeeds but the app crashes immediately on launch, that's a runtime issue rather than a compile-time one, and the debugger (attached automatically) will typically pause at the exact line where the crash occurred, assuming a breakpoint or the crash itself triggers a pause — reading the console output and the paused call stack is usually the fastest way to understand what went wrong.