Question

Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5

I have installed node@16(v16.18.0) in macOS and npm version: 8.19.2.

  • Operating System macOS(Monterey) version: 12.6
  • Xcode Verion: 14.0.1

Followed some instructions to setup react-native environment in my devices using bellow steps are mentioned:

  1. Homebrew install(Version: 3.6.7 ): /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. watchman install(Version: 2022.10.24.00): brew install watchman
  3. Install Ruby(version: 2.6.8p205): brew install ruby
  4. Install CocoaPods(gem version: 3.0.3.1): sudo gem install cocoapods
  5. CocoaPods in fixed location(pod version: 1.11.3): sudo gem install -n /usr/local/bin ffi cocoapods

After successfully installed all of the aboves I was going to create react-native app using npx react-native init AwesomeProject comand and faced Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5 error is also given in attached file. please check it and help me to suggest the way to solved.

uby version is 2.6.8, but your Gemfile specified 2.7.5

All of the resourses are mentioned below which I have follwed to solved this issues but i didn't solve it.

  1. How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting
  2. Your Ruby version is 2.5.1 but your Gemfile specified 2.4.0
  3. rbenv Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
 46  75300  46
1 Jan 1970

Solution

 101

You need to install the correct Ruby version. And it would be best if you use some ruby version manager for that. For example rbenv.

You can try these commands to install and change global Ruby version to 2.7.5

$ brew update
$ brew install ruby-build
$ brew install rbenv

$ rbenv install 2.7.5
$ rbenv global 2.7.5

After that, you need to export some configurations to define rbenv as default global ruby. For zsh users:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc

And restart the terminal or run source ~/.zshrc.

For bash users just replace zshrc with bashrc in the above.

2022-10-26

Solution

 101

You need to install the correct Ruby version. And it would be best if you use some ruby version manager for that. For example rbenv.

You can try these commands to install and change global Ruby version to 2.7.5

$ brew update
$ brew install ruby-build
$ brew install rbenv

$ rbenv install 2.7.5
$ rbenv global 2.7.5

After that, you need to export some configurations to define rbenv as default global ruby. For zsh users:

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc

And restart the terminal or run source ~/.zshrc.

For bash users just replace zshrc with bashrc in the above.

2022-10-26

Solution

 15

Below are the instructions which I have followed to solve this issue:

  1. Homebrew install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. watchman install: brew install watchman
  3. Install Ruby: followed rbenv Official Github Repo link to install the required version of ruby
  4. Install CocoaPods: sudo gem install cocoapods
  5. CocoaPods in fixed location: sudo gem install -n /usr/local/bin ffi cocoapods

After the environment setup, it works perfectly.

2022-11-08

Solution

 15

Below are the instructions which I have followed to solve this issue:

  1. Homebrew install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. watchman install: brew install watchman
  3. Install Ruby: followed rbenv Official Github Repo link to install the required version of ruby
  4. Install CocoaPods: sudo gem install cocoapods
  5. CocoaPods in fixed location: sudo gem install -n /usr/local/bin ffi cocoapods

After the environment setup, it works perfectly.

2022-11-08