1

I have been trying to install React Native into my Mac. In the installation docs, it requires Ruby version of 2.7.6 have been to be installed.

I have installed a new Ruby version using rbenv manager and it was successful. But now I cannot switch my machine to new Ruby version. Any help will be highly appreciated.

Thanks!

Umid Boltabaev
  • 442
  • 2
  • 6
  • 17
  • 1
    _"I cannot switch my machine to new Ruby version"_ is a very unspecific problem description. Why can't you do that? Is there an error message? An unexpected result? What command do you use when trying to switch? Btw. Ruby 2.7 will reach end-of-life in two months and will not receive bug-fix or security updates anymore. I suggest using a more up-to-date version of Ruby. – spickermann Jan 30 '23 at 07:23

2 Answers2

1

You can have a look at this solution

Use the below command to change your ruby version:

rbenv global 3.1.2   # set the default Ruby version for this machine
# or:
rbenv local 3.1.2    # set the Ruby version for this directory

You can find this from rbenv Official Github Repo

Yakupguly Malikov
  • 584
  • 1
  • 1
  • 12
0

You have to set the version for the directory where your react project is. You can do this with:

rbenv local 2.7.6

This creates a file called .ruby-version in the directory, which tells rbenv what version of Ruby to use.

This is all visible in the README of rbenv.

iftheshoefritz
  • 5,829
  • 2
  • 34
  • 41