rubyxcodereact-nativemacosrvm

Cant install React Native on Mac


Edit: My original task was to get React Native working on my computer. However I have run into several problems doing so. I've traced the root of the issue to my ruby version, which will not update.

when I run

gem install bundler  

I get the following

bundler requires Ruby version >= 3.0.0. The current ruby version is 2.7.1.83.

and so I tried

rvm install ruby-3.1.1

which gives me

Error running '__rvm_make -j8',
please read /Users/bekkiantonelli/.rvm/log/1714491493_ruby-3.1.1/make.log

There has been an error while running make. Halting the installation.

so essentially my issue is I am blocked from getting the correct version of ruby.

The following is my original post:

I tried following these directions : https://reactnative.dev/docs/environment-setup I am running Sonoma 14.4.1 and a Mac with a M1 chip, XCode version 15.2, ruby version 2.7.1

when I get to this step bundle install to install Bundler i get the following error:

    21: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `<main>'
    20: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:22:in `eval'
    19: from /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/bin/bundle:23:in `<main>'
    18: from /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/bin/bundle:23:in `load'
    17: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/exe/bundle:37:in `<top (required)>'
    16: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
    15: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/exe/bundle:49:in `block in <top (required)>'
    14: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/cli.rb:24:in `start'
    13: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
    12: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/cli.rb:30:in `dispatch'
    11: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
    10: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
     9: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
     8: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/cli.rb:258:in `install'
     7: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/settings.rb:133:in `temporary'
     6: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/cli.rb:259:in `block in install'
     5: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/cli/install.rb:52:in `run'
     4: from /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
     3: from /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
     2: from /Users/bekkiantonelli/.rvm/gems/ruby-2.7.1/gems/bundler-2.2.19/lib/bundler/fetcher.rb:6:in `<top (required)>'
     1: from /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': dlopen(/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/zlib.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/zlib/lib/libz.1.dylib (LoadError)
  Referenced from: <878913C8-6316-3212-A8AD-F9DD9EA034F5> /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/zlib.bundle
  Reason: tried: '/opt/homebrew/opt/zlib/lib/libz.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/zlib/lib/libz.1.dylib' (no such file), '/opt/homebrew/opt/zlib/lib/libz.1.dylib' (no such file) - /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/zlib.bundle 

also worth noting when i try

bundle exec pod install i get the following

Could not find gem 'cocoapods (>= 1.13, < 1.15)' in rubygems repository https://rubygems.org/ or installed locally.
The source does not contain any versions of 'cocoapods'
Run `bundle install` to install missing gems.

I've tried reinstalling homebrew.

I also tried

gem update --system 

which gives

Error loading RubyGems plugin "/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/gems/executable-hooks-1.7.1/lib/rubygems_plugin.rb": dlopen(/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: <F1F803B3-9EF7-3EDD-A626-FE9DC2ABDBA4> /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle
  Reason: tried: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file) - /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle (LoadError)
Error loading RubyGems plugin "/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb": dlopen(/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: <F1F803B3-9EF7-3EDD-A626-FE9DC2ABDBA4> /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle
  Reason: tried: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file) - /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle (LoadError)
ERROR:  Loading command: update (LoadError)
    dlopen(/Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle, 0x0009): Library not loaded: /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib
  Referenced from: <F1F803B3-9EF7-3EDD-A626-FE9DC2ABDBA4> /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle
  Reason: tried: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file), '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib' (no such file) - /Users/bekkiantonelli/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/-darwin22/openssl.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

i have tried using the terminal on rosetta and not on rosetta

any help would be appreciated!


Solution

  • Credits to @engineersmnky for linking the ruby update fix, I specifically used the line

    rvm install ruby-3.3.0 --reconfigure --with-openssl-dir=$(brew --prefix openssl@3)
    

    this allowed me to actually update Ruby, which was the real issue. Then I was able to cd into the project and into ios and ran

    bundle install
    bundle exec pod install
    

    and it ran correctly