Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docsite/docs/cli-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
sidebar_position: 3
title: CLI Commands
---

# CLI Commands

React Native for macOS provides several command-line tools to help you develop, build, and run your macOS applications.

## Overview

The React Native CLI for macOS extends the standard React Native CLI with macOS-specific commands. These commands help you build and run your React Native applications on macOS.

## Available Commands

### `run-macos`

Builds your React Native macOS app and launches it on your local machine.

```bash
npx react-native run-macos [options]
```

#### Options

| Option | Description | Default |
|--------|-------------|---------|
| `--mode [string]` | Set the build configuration (Debug, Release) | Debug |
| `--scheme [string]` | Explicitly set the Xcode scheme to use | `{ProjectName}-macOS` |
| `--project-path [string]` | Path relative to project root where the Xcode project lives | `macos` |
| `--no-packager` | Do not launch Metro bundler while building | `false` |
| `--port [number]` | Port for the Metro bundler | `8081` |
| `--terminal [string]` | Terminal to use for launching Metro bundler | System default |
| `--verbose` | Show detailed build output (disable xcpretty) | `false` |

### `build-macos`

Builds your React Native macOS app without launching it.

```bash
npx react-native build-macos [options]
```

#### Options

| Option | Description | Default |
|--------|-------------|---------|
| `--mode [string]` | Set the build configuration (Debug, Release) | Debug |
| `--scheme [string]` | Explicitly set the Xcode scheme to use | `{ProjectName}-macOS` |
| `--project-path [string]` | Path relative to project root where the Xcode project lives | `macos` |
| `--verbose` | Show detailed build output (disable xcpretty) | `false` |
27 changes: 19 additions & 8 deletions docsite/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,25 @@ npx react-native-macos-init

## Running a React Native macOS App

- **Without using Xcode**:
In your React Native macOS project directory, run:
### Quick Start

```
npx react-native run-macos
```
In your React Native macOS project directory, run:

- **Using Xcode**:
Open `macos\test.xcworkspace` in Xcode or run `xed -b macos`; `yarn start`. Hit the Run button.
```bash
npx react-native run-macos
```

This will build your app and launch it automatically. A Metro bundler window will also open to serve your JavaScript code.

### Alternative Methods

- **Using Xcode**: Open `macos/{YourProject}.xcworkspace` in Xcode or run `xed -b macos`, then hit the Run button.
- **Build only**: Use `npx react-native build-macos` to build without launching.

:::tip
The first run may take a while since it involves building the entire project and all dependencies. Subsequent runs will be much faster!
:::

For more detailed information about CLI commands and build options, see the [CLI Commands](./cli-commands.md).

A new Command Prompt window will open with the React packager as well as a `react-native-macos` app. This step may take a while during first run since it involves building the entire project and all dependencies. You can now start developing! 🎉
Happy coding! 🎉
Loading