I'm freshly using rvm for running a legacy project.
I installed rvm fine. Running which ruby
gives the correct rvm version:
/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin/ruby
Then running which bundle
, also indicates that bundle is using the correct rvm version:
/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin/ruby
Now to get my project running, I run bundle install
. It's important to stress on the fact that in my Gemfile I have
gem 'rails', '5.0.7'
Running rails s
after those steps, gives:
Rails is not currently installed on this system. To get the latest version, simply type:
Running which rails
gives:
/usr/bin/rails
implying that the system version and not the rvm version is being used.
echo $PATH
shows:
/Users/Mahmoud/.rvm/gems/ruby-2.5.5/bin:/Users/Mahmoud/.rvm/gems/ruby-2.5.5@global/bin:/Users/Mahmoud/.rvm/rubies/ruby-2.5.5/bin:/Users/Mahmoud/.rvm/bin:/Users/Mahmoud/.pyenv/versions/3.7.2/bin:/usr/local/bin:/Users/Mahmoud/.pyenv/bin:/usr/local/opt/openssl@3/bin:/usr/local/opt/openssl@3/bin:/usr/local/opt/libxml2/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/Users/Mahmoud/.ebcli-virtual-env/executables:/usr/local/mysql/bin
My question is, why hasn't rails been installed when I used bundle install? And why is which rails
refering to my system and not my rbenv path?
CodePudding user response:
I'll bet your RVM isn't set up correctly and /usr/bin/
appears in your PATH
before RVM's bin directory. Run echo $PATH
to confirm.
If so, back up your dotfiles for safety and run rvm get head --auto
and it should put your PATH right. Logout and log back in or source your dotfiles (source ~/.bash_profile
or whatever) and try again.