3

I'm pretty new to Ruby and pod installation. Currently I have Ruby installed through RVM. However I'd like to install a pod through bundler by bundle exec pod install.

I keep getting the following error that my current version of Ruby is different from Gemfile specified. My current version of Ruby via RVM is same with Gemfile version. (So if I do pod install it won't cause any issues).

My gem env shows different Ruby Version.

How can I go about changing that? Where does gem env live? I saw some instructions here to install a RubyGem. But I'm having trouble following this. Any advice helps!

➜ ios git:(main) bundle exec pod install
Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5
➜  ios git:(main) gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.3.1
  - RUBY VERSION: 2.6.8 (2021-07-07 patchlevel 205) [universal.x86_64-darwin21]
  - INSTALLATION DIRECTORY: /Users/myusername/.gem
  - USER INSTALLATION DIRECTORY: /Users/myusername/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /Users/myusername/.gem/bin
  - SPEC CACHE DIRECTORY: /Users/myusername/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-21
  - GEM PATHS:
     - /Users/myusername/.gem
     - /Users/myusername/.gem/ruby/2.6.0
     - /Library/Ruby/Gems/2.6.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
Sak
  • 41
  • 4
  • It could be that `bundle` is not installed for 2.6.8. – tadman Oct 13 '22 at 03:55
  • RUBY EXECUTABLE points to a system-wide Ruby installation, not an RVM-managed one (in this case the path would be local to your home, smth. like `/Users/myusername/.rvm/rubies/ruby-2.6.8/bin/ruby`. It seems something is not ok with the RVM installation, double check if you did it properly. Starting from the simplest thing: did you set up a default Ruby after installing RVM... – Konstantin Strukov Oct 13 '22 at 07:36
  • @KonstantinStrukov Thanks. I went back to RVM webpage to find this comment that ultimately did the trick. : For non-interactive shells RVM will be added to PATH only, not loaded. This means using rubies is not possible in this mode, but there are simple methods to load ruby: `source $(rvm 2.7.5 do rvm env --path)` – Sak Oct 23 '22 at 07:02

0 Answers0