Reputation: 465
I am trying to learn Ruby on Rails, I have installed Ruby, ruby -v
gives ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
and I have installed rails using gem install rails
however when I run rails -v
I get the following dialogue.
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
I then do as the prompt asks and run sudo gem install rails
(inputting my pw) which gives me;
Successfully installed rails-6.0.2.2
Parsing documentation for rails-6.0.2.2
Done installing documentation for rails after 0 seconds
1 gem installed
to check that Rails has installed properly I run rails -v
again, and again I get;
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
Am I missing something very obvious?
Upvotes: 0
Views: 48
Reputation: 186
The best way to manage your Ruby/Rails environment is to use a tool like rvm
and never use the system Ruby/Rails. Changing Ruby/Rails versions globally for all your apps will most likely break them, so you want each app to be locked to a specific Ruby/Rails version and only upgrade each one manually.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
source $HOME/.rvm/scripts/rvm
mkdir my_rails_app && cd my_rails_app
.ruby-version
and .ruby-gemset
for each project:echo 2.6.5 > .ruby-version
echo my_rails_app > .ruby-gemset
rvm reload
gem install rails
rails new my_rails_app .
Upvotes: 1