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
Copy file name to clipboardExpand all lines: docs/_getting-started-macos-ios.md
+35-9Lines changed: 35 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ import M1Cocoapods from './\_markdown-m1-cocoapods.mdx'; import RemoveGlobalCLI
2
2
3
3
## Installing dependencies
4
4
5
-
You will need Node, Watchman, the React Native command line interface, Xcode and CocoaPods.
5
+
You will need Node, Watchman, the React Native command line interface, a Ruby version manager, Xcode and CocoaPods.
6
6
7
7
While you can use any editor of your choice to develop your app, you will need to install Xcode in order to set up the necessary tooling to build your React Native app for iOS.
8
8
@@ -19,6 +19,31 @@ If you have already installed Node on your system, make sure it is Node 14 or ne
19
19
20
20
[Watchman](https://facebook.github.io/watchman) is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.
21
21
22
+
### Ruby
23
+
24
+
React Native uses a `.ruby-version` file to make sure that your version of Ruby is aligned with what is needed. Currently, macOS 12.5.1 is shipped with Ruby 2.6.8, which is **not** what is required by React Native. Our suggestion is to install a Ruby version manager and to install the proper version of Ruby in your system.
-[asdf-vm](https://github.com/asdf-vm) with the [asdf-ruby](https://github.com/asdf-vm/asdf-ruby) plugin
32
+
33
+
To check what is your current version of Ruby, you can run this command:
34
+
35
+
```
36
+
ruby --version
37
+
```
38
+
39
+
React Native uses [this version](https://github.com/facebook/react-native/blob/main/template/_ruby-version) of Ruby. You can also find which version your specific project needs in the `.ruby-version` file at root of your RN project.
40
+
41
+
### Bundler
42
+
43
+
[Bundler](https://bundler.io/) is a Ruby gem that helps managing the Ruby dependencies of your project. We need Ruby to install Cocoapods and using Bundler will make sure that all the dependencies are aligned and that the project works properly.
44
+
45
+
If you want to learn more about why we need this tool, you can read [this article](https://bundler.io/guides/rationale.html#bundlers-purpose-and-rationale).
46
+
22
47
### Xcode
23
48
24
49
The easiest way to install Xcode is via the [Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?mt=12). Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.
@@ -39,14 +64,6 @@ To install a simulator, open <strong>Xcode > Preferences...</strong> and select
39
64
40
65
[CocoaPods](https://cocoapods.org/) is built with Ruby and it will be installable with the default Ruby available on macOS.
41
66
42
-
Using the default Ruby available on macOS will require you to use `sudo` when installing gems. (This is only an issue for the duration of the gem installation, though.)
43
-
44
-
```shell
45
-
sudo gem install cocoapods
46
-
```
47
-
48
-
Otherwise you can use a Ruby version manager, such as `rbenv`. Apps created with the command `npx react-native init` described below are configured to work well with `rbenv` and will pick the correct Ruby version requested by the template.
49
-
50
67
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
This is not necessary if you are integrating React Native into an existing application, if you "ejected" from Expo, or if you're adding iOS support to an existing React Native project (see [Integration with Existing Apps](integration-with-existing-apps.md)). You can also use a third-party CLI to init your React Native app, such as [Ignite CLI](https://github.com/infinitered/ignite).
69
86
87
+
:::info
88
+
If you are having trouble with iOS, try to reinstall the dependencies by running:
89
+
90
+
1.`cd ios` to navigate to the
91
+
2.`bundle install` to install Bundler
92
+
1. If needed: install a [Ruby Version Manager](#ruby) and update the Ruby version
93
+
3.`bundle exec pod install` to install the iOS dependencies.
94
+
:::
95
+
70
96
### [Optional] Using a specific version or template
71
97
72
98
If you want to start a new project with a specific React Native version, you can use the `--version` argument:
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.70/_getting-started-macos-ios.md
+35-9Lines changed: 35 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ import M1Cocoapods from './\_markdown-m1-cocoapods.mdx'; import RemoveGlobalCLI
2
2
3
3
## Installing dependencies
4
4
5
-
You will need Node, Watchman, the React Native command line interface, Xcode and CocoaPods.
5
+
You will need Node, Watchman, the React Native command line interface, a Ruby version manager, Xcode and CocoaPods.
6
6
7
7
While you can use any editor of your choice to develop your app, you will need to install Xcode in order to set up the necessary tooling to build your React Native app for iOS.
8
8
@@ -19,6 +19,31 @@ If you have already installed Node on your system, make sure it is Node 14 or ne
19
19
20
20
[Watchman](https://facebook.github.io/watchman) is a tool by Facebook for watching changes in the filesystem. It is highly recommended you install it for better performance.
21
21
22
+
### Ruby
23
+
24
+
React Native uses a `.ruby-version` file to make sure that your version of Ruby is aligned with what is needed. Currently, macOS 12.5.1 is shipped with Ruby 2.6.8, which is **not** what is required by React Native. Our suggestion is to install a Ruby version manager and to install the proper version of Ruby in your system.
-[asdf-vm](https://github.com/asdf-vm) with the [asdf-ruby](https://github.com/asdf-vm/asdf-ruby) plugin
32
+
33
+
To check what is your current version of Ruby, you can run this command:
34
+
35
+
```
36
+
ruby --version
37
+
```
38
+
39
+
React Native uses [this version](https://github.com/facebook/react-native/blob/main/template/_ruby-version) of Ruby. You can also find which version your specific project needs in the `.ruby-version` file at root of your RN project.
40
+
41
+
### Bundler
42
+
43
+
[Bundler](https://bundler.io/) is a Ruby gem that helps managing the Ruby dependencies of your project. We need Ruby to install Cocoapods and using Bundler will make sure that all the dependencies are aligned and that the project works properly.
44
+
45
+
If you want to learn more about why we need this tool, you can read [this article](https://bundler.io/guides/rationale.html#bundlers-purpose-and-rationale).
46
+
22
47
### Xcode
23
48
24
49
The easiest way to install Xcode is via the [Mac App Store](https://itunes.apple.com/us/app/xcode/id497799835?mt=12). Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.
@@ -39,14 +64,6 @@ To install a simulator, open <strong>Xcode > Preferences...</strong> and select
39
64
40
65
[CocoaPods](https://cocoapods.org/) is built with Ruby and it will be installable with the default Ruby available on macOS.
41
66
42
-
Using the default Ruby available on macOS will require you to use `sudo` when installing gems. (This is only an issue for the duration of the gem installation, though.)
43
-
44
-
```shell
45
-
sudo gem install cocoapods
46
-
```
47
-
48
-
Otherwise you can use a Ruby version manager, such as `rbenv`. Apps created with the command `npx react-native init` described below are configured to work well with `rbenv` and will pick the correct Ruby version requested by the template.
49
-
50
67
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
This is not necessary if you are integrating React Native into an existing application, if you "ejected" from Expo, or if you're adding iOS support to an existing React Native project (see [Integration with Existing Apps](integration-with-existing-apps.md)). You can also use a third-party CLI to init your React Native app, such as [Ignite CLI](https://github.com/infinitered/ignite).
69
86
87
+
:::info
88
+
If you are having trouble with iOS, try to reinstall the dependencies by running:
89
+
90
+
1.`cd ios` to navigate to the
91
+
2.`bundle install` to install Bundler
92
+
1. If needed: install a [Ruby Version Manager](#ruby) and update the Ruby version
93
+
3.`bundle exec pod install` to install the iOS dependencies.
94
+
:::
95
+
70
96
### [Optional] Using a specific version or template
71
97
72
98
If you want to start a new project with a specific React Native version, you can use the `--version` argument:
0 commit comments