You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
React Native for macOS provides several command-line tools to help you develop, build, and run your macOS applications.
9
+
10
+
## Overview
11
+
12
+
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.
13
+
14
+
## Available Commands
15
+
16
+
### `run-macos`
17
+
18
+
Builds your React Native macOS app and launches it on your local machine.
19
+
20
+
```bash
21
+
npx react-native run-macos [options]
22
+
```
23
+
24
+
#### Options
25
+
26
+
| Option | Description | Default |
27
+
|--------|-------------|---------|
28
+
|`--mode [string]`| Set the build configuration (Debug, Release) | Debug |
29
+
|`--scheme [string]`| Explicitly set the Xcode scheme to use |`{ProjectName}-macOS`|
30
+
|`--project-path [string]`| Path relative to project root where the Xcode project lives |`macos`|
31
+
|`--no-packager`| Do not launch Metro bundler while building |`false`|
32
+
|`--port [number]`| Port for the Metro bundler |`8081`|
33
+
|`--terminal [string]`| Terminal to use for launching Metro bundler | System default |
34
+
|`--verbose`| Show detailed build output (disable xcpretty) |`false`|
35
+
36
+
### `build-macos`
37
+
38
+
Builds your React Native macOS app without launching it.
39
+
40
+
```bash
41
+
npx react-native build-macos [options]
42
+
```
43
+
44
+
#### Options
45
+
46
+
| Option | Description | Default |
47
+
|--------|-------------|---------|
48
+
|`--mode [string]`| Set the build configuration (Debug, Release) | Debug |
49
+
|`--scheme [string]`| Explicitly set the Xcode scheme to use |`{ProjectName}-macOS`|
50
+
|`--project-path [string]`| Path relative to project root where the Xcode project lives |`macos`|
51
+
|`--verbose`| Show detailed build output (disable xcpretty) |`false`|
Copy file name to clipboardExpand all lines: docsite/docs/getting-started.md
+19-8Lines changed: 19 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,14 +37,25 @@ npx react-native-macos-init
37
37
38
38
## Running a React Native macOS App
39
39
40
-
-**Without using Xcode**:
41
-
In your React Native macOS project directory, run:
40
+
### Quick Start
42
41
43
-
```
44
-
npx react-native run-macos
45
-
```
42
+
In your React Native macOS project directory, run:
46
43
47
-
-**Using Xcode**:
48
-
Open `macos\test.xcworkspace` in Xcode or run `xed -b macos`; `yarn start`. Hit the Run button.
44
+
```bash
45
+
npx react-native run-macos
46
+
```
47
+
48
+
This will build your app and launch it automatically. A Metro bundler window will also open to serve your JavaScript code.
49
+
50
+
### Alternative Methods
51
+
52
+
-**Using Xcode**: Open `macos/{YourProject}.xcworkspace` in Xcode or run `xed -b macos`, then hit the Run button.
53
+
-**Build only**: Use `npx react-native build-macos` to build without launching.
54
+
55
+
:::tip
56
+
The first run may take a while since it involves building the entire project and all dependencies. Subsequent runs will be much faster!
57
+
:::
58
+
59
+
For more detailed information about CLI commands and build options, see the [CLI Commands](./cli-commands.md).
49
60
50
-
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! 🎉
0 commit comments