build-and-run-macos-app

Creates and runs a project-local build_and_run.sh script for macOS Xcode and SwiftPM apps.

4.0k|410|Updated Feb 1, 2026
One-click install
npx skills add https://github.com/robinebers/openusage --skill build-and-run-macos-app
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-and-run-macos-app
Source: https://github.com/robinebers/openusage/tree/main/.agents/skills/build-and-run-macos-app
Command: npx skills add https://github.com/robinebers/openusage --skill build-and-run-macos-app

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

macOS projects lack a consistent, repeatable way to stop the running app, rebuild it, and relaunch the fresh binary, forcing developers to juggle Xcode, SwiftPM, and manual process management.

Core Features & Use Cases

  • Automatic project detection: Detects whether the repo uses an Xcode workspace, Xcode project, or SwiftPM package and adapts the build flow accordingly.
  • Canonical build script generation: Creates or updates script/build_and_run.sh so it always kills the current app, builds the macOS target, and launches the result, with optional --debug, --logs, --telemetry, and --verify modes.
  • GUI app handling: For AppKit/SwiftUI SwiftPM apps, builds a project-local .app bundle and launches it with /usr/bin/open -n instead of raw executable launch.
  • Use Case: After cloning a SwiftUI menu bar app, invoke the skill once to generate the build script, then rebuild and relaunch the app after every code change with a single command.

Quick Start

Run /build-and-run-macos-app to generate the build script and launch my macOS app in run mode.

Frequently Asked Questions about build-and-run-macos-app

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build and run a macOS app from the command line?

Invoke the skill to generate script/build_and_run.sh, which stops the running app, builds the macOS target via xcodebuild or SwiftPM, and launches the fresh result. Run the script with no flags for the default kill-build-run cycle.

How to run a SwiftPM SwiftUI app as a proper .app bundle?

The skill creates a project-local .app bundle for AppKit/SwiftUI SwiftPM executables and launches it with /usr/bin/open -n. Raw executable launch is kept only for true CLI tools, since GUI apps need a bundle to behave correctly.

Does this work with both Xcode projects and Swift packages?

Yes, the workflow detects whether the repo uses an .xcworkspace, .xcodeproj, or SwiftPM package and adapts the generated script accordingly. You can also pass scheme, workspace, project, or product arguments explicitly.

What modes does the build script support besides run?

The generated script supports --debug, --logs, --telemetry, and --verify flags in addition to the default run mode. These optional modes are only used when explicitly requested; the no-flag path stays a simple kill, build, run.

Will it initialize git in my project automatically?

It runs git init at the project root only if the workspace is not yet inside git, unlocking git-backed editor features. It never initializes a nested repository inside an existing parent checkout.