I installed Rails 3 by following this gist: http://gist.github.com/296055
But when I try "rails" in terminal I get the following error:
/Users/yves/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0/lib/rails: Is a directory - /Users/yves/.rvm/gems/ruby-1.9.2-head/gems/activerecord-3.0.0/lib/rails (Errno::EISDIR)
from /usr/bin/rails:19:in `load'
from /usr/bin/rails:19
Any ideas?
UPDATE
Ok, I figured out something. I can run the correct rails by going directly to the right executable:
/Users/yves/.rvm/gems/ruby-1.9.2-head/gems/rails-3.0.0/bin/rails
Apparantly my "rails" command is still linked another version, the one in usr/local/bin
How can I change this?
Check out my answer on this other question:
(if this works for you, we should mark this as a duplicate question. But I don't have enough points to do that myself)
--
Older versions of rvm had a bug that can cause your ruby versions to get crosswired because the OS can cache executable paths for the which command (particularly if you are using zsh). See this long, detailed, mind blowing post by Yehuda Katz on the subject.
What I had to do this morning:
rvm update && rvm reload # update rvm
rvm gemset delete rails3 # delete old gemset
rvm install 1.9.2
rvm use 1.9.2
rvm gemset create rails3
rvm use 1.9.2#rails3
which ruby # check to be sure the ruby interpretter is properly set to 1.9.2
hash -r # if ruby interpretter is not pointing to 1.9.2
gem install rails
which rails # check to be sure we are using rvm version of rails
I followed this article and was able to install everything. The article is in Russian, but you should be able to translate it to desired language via Google translate.
I bumped into 'no ssl' error but this article explains how to resolve it as well (at the bottom).
My setup now is:
RVM
Ruby 1.8.7 + Rails 2.3.8
Ruby 1.9.2 + Rails 3.0.0
Hope this will help you.
Related
I have been learning Ruby on Rails for a couple of months, and everything was working.
Then, for the needs of a tutorial, I tried to install RVM, in order to downgrade my setup to older versions of Ruby and Rails.
And since then, I kept running into troubles.
For instance, anytime I launch a new Terminal session, here is what I get:
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers,
you can switch to '.ruby-version' using 'rvm rvmrc to [.]ruby-version'
or ignore this warning with 'rvm rvmrc warning ignore /Users/Thibaud/work/.rvmrc',
'.rvmrc' will continue to be the default project file in RVM 1 and RVM 2,
to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
ree-1.8.7-2012.02 - #gemset created /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02#tedxperth
ree-1.8.7-2012.02 - #generating tedxperth wrappers....................
Using /Users/Thibaud/.rvm/gems/ree-1.8.7-2012.02 with gemset tedxperth
Warning! Executable 'ruby' missing, something went wrong with this ruby installation!
Warning! Executable 'gem' missing, something went wrong with this ruby installation!
Warning! Executable 'irb' missing, something went wrong with this ruby installation!
Two questions:
How can I resolve the errors appearing in my Terminal? (see above)
Since I do not know what got broken in my install, I am wondering whether I should unsintall the whole Ruby on Rails environment and set it up again to get a clean install: Is this a good idea? If so, how can it be achieved?
Your first set of errors will go away if your remove the hidden .rvmrc file in your project directory:
$ rm .rvmrc
The file only exists to set a Ruby version and gemset when you cd into the directory. You can either set the Ruby version and gemset manually, or create new .ruby-version and .ruby-gemset files which are compatible with RVM and other version managers. For details, see my answer Use rvmrc or ruby-version file to set a project gemset with RVM?.
You may need to remove and reinstall the Ruby version you are using. Here's how:
$ rvm remove ree-1.8.7-2012.02
Here's the documentation.
You probably don't need to uninstall RVM. But if you do, you can use
$ rvm implode
to remove all traces of RVM before re-installing (documented here). For more details on installing Ruby and multiple versions of Rails using RVM, see the article I wrote:
Install Ruby on Rails - Mac OS
X
Lastly, since you mention that you are reading a tutorial that requires an old version of Rails, may I politely suggest you have a look at a book I've written for beginners that is up to date with the newest version of Rails (currently Rails 4.1 but I revise the book with every new release). I hope it is helpful:
Learn Ruby on
Rails
I mention my article and my book because they provide additional information about setting your development environment for Rails using RVM and may answer further questions for you.
Hi there thanks for looking into this.
after a clean install of Linux ubuntu 10.10 i tried to re-install rails.
after doing sudo gem install rails, I can see I am returned version 3.2.3 of rails
But after generating a new project i couldn't find my gemfile so i tried ruby -v which returns 2.3.4 wich is odd since I know I got the latest.
Also when trying sudo gem update --system I get an error because I might override system files. any solution here?
I'd recommend using rvm to manage your ruby sets -- as well as defining gemsets for each project that will allow you to make sure each project has just the gems it needs.
Here's a link to the rvm installation instructions (they should work with ubuntu):
https://rvm.io/rvm/install/
Here's some info on basic use of gemsets with rvm:
https://rvm.io/gemsets/basics/
Also, when using rails 3+, you should make a practice of typing bundle exec rails -v -- that way you'll use the gems defined for the project you're in.
Can you try typing bundle exec rails -v and letting us know what you see?
I installed ruby as per instructions given here but when I do ruby--version then it still shows 1.8.7. How do I make sure I use newly installed Ruby?
I would suggest you to use RVM (Ruby Version Manager). You may find a full installation guide here:
http://ryanbigg.com/2011/06/mac-os-x-ruby-rvm-rails-and-you/
If you get an error such as "ERROR: Error running ' ./configure...." after executing rvm install e.g.
rvm install 1.9.3
Then you may try to install it like this:
rvm install 1.9.3 --with-gcc=clang
Note: in the guide this possible error is not described
Did you properly setup your PATH? What's the output of echo $PATH? /usr/local/bin has to come first they way this tutorial sets up things. You see that everything worked right when which ruby displays /usr/local/bin/ruby.
Personally I'd recommend using a tool for managing Ruby versions though. RVM still seems to be the most popular choice, I prefer the combination of rbenv and ruby-build.
trying to install bcrypt-ruby-2.1.4. I have to use rvm to remove ruby 1.9.2, then reinstall/compile, then I can install the bcrypt gem, however the gem is only active in that one terminal session. If I open another tab in terminal I get the following error "Could not find bcrypt-ruby-2.1.4 in any of the sources"
If I close the terminal, I will no longer be able to use the bcrypt gem (or json, or cucumber) unless I remove and recompile ruby again?
Not sure how to even google for help on this? Any ideas or help would be greatly appreciated.
Bobby
running osx 10.6.8
ruby 1.9.2-p180
You're probably using a different rvm set when you're opening a new terminal.
Since OS X doesn't come with Ruby 1.9.2, you are being defaulted to the system installation of Ruby.
http://beginrescueend.com/rubies/default/ Check out this link to learn how to set a default Ruby version.
Go to your terminal and type in
rvm --default use 1.9.2
This will make 1.9.2 the default Ruby in all Terminal windows.
I'm trying to keep along with the Tekpub Build your own blog on rails screencast. I'm still very much a ruby novice and the problem is that I have Rails 3 installed while Rob uses an older version (Of the top of my head: version 2.3.2).
I know how to get that version of rails with gem install rails --version=2.3.2 but when I type rails new the version of the application is rails 3. How do I make this particular app work with the older version? I know this has something to do with rvm but I have no idea how to do anything but the basic rvm use operation.
Try,
rvm use <ruby version>
rvm gemset create rails2.3.2
rvm <ruby version>#rails2.3.2
gem install rails --version=2.3.2
Finally the syntax to create a new rails app in older versions of rails was just:
rails <appanme>
For more information about gemsets:
RVM: Named Gem Sets
This will install Ruby 1.8.7 and then create a gemset that will contain only a specific set of gems:
rvm install 1.8.7
rvm --create use 1.8.7#old_rails
gem install rails --version=2.3.2
Whenever you want to use this after the first time just:
rvm use 1.8.7#old_rails
.rvmrc files are really useful for automatically managing different sets of Ruby versions and gems. If you create file called .rvmrc in the project directory and put this line in it:
rvm --create use 1.8.7#old_rails
Then every time you cd into that directory RVM will switch to Ruby 1.8.7 and the gemset "old_rails". Have a look at the docs for .rvmrc here: http://rvm.beginrescueend.com/workflow/rvmrc/
Of course you can change "1.8.7" for "1.8.6", "1.8.7-p249", "ree-1.8.7-2010.02" or any other Ruby version you like, I just assumed that you would want 1.8.7.
Have a look at RVM (Ruby Version Manager)