0

I have set-up rbenv which sets my local version properly. However when I use executables like ruby or gem, it still uses (macos) system defaults

My rbenv local setup shows correctly

[(adikshit@LG962GRKWG) (25-08-14 14:03) (BasicRubyProject-v3.1.6)]:$ rbenv local
3.1.6

Just using gem still points to system default gem version. The gem and ruby executables under /usr/bin are MacOs default ruby binaries.

[(adikshit@LG962GRKWG) (25-08-14 14:04) (BasicRubyProject-v3.1.6)]:$ whence gem
/usr/bin/gem

Same with the ruby command

[(adikshit@LG962GRKWG) (25-08-14 14:05) (BasicRubyProject-v3.1.6)]:$ whence ruby
/usr/bin/ruby

However using rbenv gem command correctly points to the local gem version.

[(adikshit@LG962GRKWG) (25-08-14 14:05) (BasicRubyProject-v3.1.6)]:$ rbenv which gem
/Users/adikshit/.rbenv/versions/3.1.6/bin/gem
[(adikshit@LG962GRKWG) (25-08-14 14:05) (BasicRubyProject-v3.1.6)]:$

My understanding is that once I have setup a local environment and switch to the directory, all commands like ruby, gem etc will use the binaries of the local environment (in this case 3.1.6) and not the system defaults.

Am I missing something here? Thank you!

5
  • 3
    Did you run rbenv init and the close and reopen your terminal? Commented Aug 15 at 2:23
  • have a look at stackoverflow.com/questions/10940736/… and its comments and read github.com/rbenv/… Commented Aug 18 at 12:41
  • @engineersmnky yes I have. Commented Aug 27 at 20:42
  • @OliverGaida actually I did. I posted my solution in the comments as well stackoverflow.com/a/79747801/326439 this solution worked for my specific case. I had followed the top answers and that didn't work. Commented Aug 27 at 20:43
  • rbenv-doctor, which you can find right here github.com/rbenv/rbenv-installer could help you. What happens when u use rbenv global 3.1.6 ? Commented Sep 23 at 15:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.