Please help with setting up Ruby on Rails

ruby
ruby-on-rails

#1



Hi guys,

I need your help with setting up Ruby on Rails on my Mac.

I've Mac OS Sierra and I've installed Ruby 2.4.0 and Rails 5.0.1 with my Terminal.

The thing is, when I open my terminal for a new session and type in ruby -v, the terminal gives me this:

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

And when I type in rails -v, I get this:

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

I know for sure that I've installed Ruby 2.4.0 and Rails 5.0.1 and yet my system tells me that I've Ruby 2.0.0 and I've not installed rails.

Why is that? Any idea?

The only solution I've found is to write this:

source ~/.rvm/scripts/rvm

When I do, the terminal gives me the right version for both Ruby and Rails.

I don't want to have to write it. I just want to open my terminal and get the version right away.

Hopefully it makes sense, I'm totally new to this.

Thank you so much for you help!

Simon


#2

In your ~/.bash_profile, edit your PATH variable so that the executable you want is found first.

What I do is to put ~/bin first (or before system paths anyway) and create symlinks there to versions I prefer.
If you've installed ruby with some form of package manager that manages versions, then perhaps it has some directory of executables that you would want to add somewhere early in your PATH

You could also source rvm in your ~/.bash_profile
rvm is probably overkill if you're not looking to manage multiple versions of various ruby software


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.