Reinstall Rails every time I restart my computer? - ruby-on-rails

My issue concerns my inability to keep a working version of RoR on my mac OSX 10.6.8. I've been working through various books that teach Rails, but the biggest issue I keep running into is that the Rails installation seems to disappear whenever I restart my computer. I have a directory on my desktop, within which I put all of my Rails projects. Whenever I attempt to open that folder in terminal and create a new rails app,
rails new examplename
I get met with this error:
/Library/Ruby/Site/1.8/rubygems/dependency.rb:313:in `to_specs':
Could not find 'rails' (>= 0) among 12 total gem(s) (Gem::LoadError)
Checked in
'GEM_PATH=/Users/greyelerson/.rvm/gems/ruby-1.9.3-p547:/Users/greyelerson/.rvm/gems/ruby-1.9.3- p547#global', execute `gem env` for more information
from /Library/Ruby/Site/1.8/rubygems/dependency.rb:322:in `to_spec'
from /Library/Ruby/Site/1.8/rubygems/core_ext/kernel_gem.rb:58:in `gem'
from /usr/bin/rails:18
The only "solution" which has allowed me to continue thus far has been to completely reinstall ruby and then reinstall rails every time I want to work. There has got to be a real and permanent fix for this. Please help.

Rather than installing Rails into the system version of Ruby, I would recommend that you instead install your own copy of Ruby in your home directory using RVM. That way, your changes won't conflict with the system's changes. For example, if Apple decides to update Ruby to a new version that's incompatible with your version of Rails, you're still safe because you have your own version in your home directory. You can also install multiple versions of Ruby if you want to test your code with beta versions or whatever.

Related

how to completely uninstall ruby + gems + rails out of my Ubuntu 14.04 and then start installing them as fresh

I am having a lot of issues on ruby & gem installation due to which my running projects are stopped working.
Current issues
Can anyone please guide me on "how to completely uninstall ruby + gems + rails out of my Ubuntu 14.04 and then start installing them as fresh".
I am also unable to remove this. Maybe once I completely throughout of my system. It may allow me to fresh install ruby n rails. Looking into this in order to make things work again.
Can anyone help?
If you can see my question up there, I have rbenv, ruby and rails installed and a lot more. I am not able to run it though. And due to which I am thinking of removing it out of my system and install them as fresh. Today, I somehow was able to fix a few issues and created a new rails application and started the server using MySQL. But, its too showing errors on other ruby lib command: rails script/generate model Book Rails is throwing me errors.
/home/<user>/.rvm/gems/ruby-2.5.3/gems/railties-5.2.1/lib/rails/app_loader.rb:53: warning: Insecure world writable dir /home/<user>/.rvm/gems/ruby-2.5.3/bin in PATH, mode 040777
rails aborted!
Don't know how to build task 'script/generate' (see --tasks)
Can anyone help?
I highly highly recommend not touching the built-in ruby/rails/gems installation.
It's pretty standard these days to use a very lightweight manager, like rbenv which allows you to work with multiple versions of ruby, each with it's own installations of gems. There is also rvm, which is a heavier manager and a bit more invasive.
install the newer versions with rbenv
brew install rbenv
rbenv init
Close your Terminal window and open a new one so your changes take effect.
Verify that rbenv is properly set up using this rbenv-doctor script.
rbenv install.
brew upgrade rbenv ruby-build
and then install rails
ruby on rails setup
for database i preferred sqlite browser

Rails Installation/Startup Issue

I made a mistake earlier today where I ran a git clean -f command and it seems to have wiped out rails and rvm. I tried to re-install both, and the installations seemed to work, but when I try to run the rails -v I get a gem load error. This tells me that the installation did not work properly, even though I watched railties get installed a few minutes ago. Does anyone have any advice for this sitation? Or do you have experience troubleshooting an error like this?
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:into_specs': Could not find 'railties' (>= 0) among 19 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:into_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:ingem'
from /usr/bin/rails:22:in <main>'
try the simple stuff first, bundle install, restoring from git depending on what your branches were. Finally you made need to just uninstall and reinstall
How can I uninstall Ruby on Rails on Mac OS X?
https://gauravsohoni.wordpress.com/2014/01/01/rvm-implode-and-rvm-install/

Updating Ruby 1.9.3 -> 2.0.0 without losing gems

Have had 1.9.3p194 (RubyInstaller) with Ruby on Rails and all kinds of Gems installed on my WinXP. Now I want to update the whole setup.
Updating RoR (to 4.0.0) and gems was easy: gem update rails, gem update --system, gem update.
But how do I do that with Ruby? Is there an easy way to update the installation?
If not, and I have to install the fresh package, then how do I do it with little hassle?
I have downloaded the fresh 2.0 RubyInstaller. I have read that I shouldn't install this new Ruby version in the same directory as my old Ruby version (c:\programs\Ruby) that's why I chose a c:\programs\Ruby200 directory. During the installation I clicked on every additional setting, including the "include new directory in the PATH variable" type of choice. But now when I type ruby -v I still get 1.9.3p194 and the new directory is absent from PATH (I haven't rebooted, so maybe this has something to do with it).
So how should I really install the new version? Should I simply change the old PATH to the new one? Or should I instead only add the new one without removing the old path (so there will be some kind of advantage of having both 1.9.3 and 2.0)? Or should I simply delete both installations and install 2.0 from the start?
How do I easily transfer the gems (or the list of them, so the gem update could handle the installation/updating) from my old installation to the new one?
I am using JetBrains RubyMine 5.4 editor, and would like to know if I need to do something there as well (for both the new and the existing projects).
Like many POSIX users, I rely on rvm and bundler to manage ruby versions & gemsets. Unfortunately, rvm is not available on windows. Although I haven't tried it personally, it looks like pik is a viable windows alternative. I would recommend checking that out.
You should also definitely look into bundler if you're not already using it; since bundler is just a gem, it should be platform independent.

RailsInstaller not completing install on OS X 10.6, not responding

I'm new to Ruby on Rails and to web development in general. Yesterday I successfully installed Git, osx-gcc-installer, RVM and Ruby on my Mac OS X 10.6. To try to get Rails and everything else I need, I downloaded RailsInstaller for OS X 10.6 and apparently made it at least through the unpacking of files, but now I have the RailsInstaller Setup window hanging on my machine for over two hours. It has a message "Completing the RailsInstaller setup wizard"... "Setup has finished installing Railsinstaller on your computer." Clicking on Finish, Back, anything does absolutely nothing; the window just sits there. Clearly something is not working, and I'm not sure what to do. I checked the Rails install in the terminal and got the following message:
$ rails --help
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:827:in report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:261:inactivate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:68:in `gem'
from /usr/bin/rails:18
I'm hesitant to start killing processes or restart my machine. Also wondering if I'm going to have to purge everything I've already installed and start over from scratch, and not sure how I would go about that.
Any thoughts would be appreciated. Thanks.
I had trouble running the installer as well. It was not exactly the same issues you had.
Running the installer from the terminal as root worked much better for me.
The command would look something like this:
sudo ./RailsInstaller-1.0.4-osx-10.7.app/Contents/MacOS/osx-intel --mode text
If that does not work, you can get additional debugging diagnostics with the --debuglevel flag.

Trying to get Ruby/Rails installed on OSX Mountain Lion

This is my first question please be nice.
I've been trying to get my hands dirty with ruby/rails for a small coding project. I have Mountain Lion, and have been trying to use various techniques i've found on stackoverflow, and across the interwebs. It's not going so great! Nothing works of course. I have the system version of Ruby (1.8.7) as of now, and a bunch of broken junk from trying and failing to install Ruby!
When I install Rails via gem install, it sat for awhile... I finally learned to use -V, and noticed everything was returning back 302, and this takes forever, and finally it installs -- I get this output when I try to run rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate': can't activate rack (~> 1.4.5, runtime) for ["actionpack-3.2.13", "railties-3.2.13"], already activated rack-1.5.2 for ["rack-ssl-1.3.3", "railties-3.2.13"] (Gem::LoadError)
It looks like some dependencies are broken? Anyhow I'm now trying to use RVM now to get another version of ruby and setup grails with brew, This is telling me that I need a newer version of ruby to install anything pretty much?? Here is the output.
rvm install 1.9.2-head
Installing requirements for osx, might require sudo password.
Skipping brew update make sure your formulas are up to date.
Cowardly refusing to continue, please read 'rvm autolibs'.
To proceed rvm requires a ruby-1.9|ruby-2 compatible ruby is installed.
We attempted to install ruby automatically but it failed.
Please install it manually (or a compatible alternative) to proceed.
-- I am getting os frustrated here, please throw me a bone and help me out --- If I have to have to I'll setup a linux vm just to get rails running -- yet I prefer working on my mac.
Please any advice?? I just want a working version of Rails 3 on my Mac this is allThanks in advance
Please go through www.railsinstaller.org for detailed installation and setup process. This guide should answer all of your questions.
Have you tried this tutorial http://net.tutsplus.com/tutorials/ruby/how-to-install-ruby-on-a-mac/
The tutorial includes all the errors you may come across during the installation.
According to this tutorial Ruby on Rail comes with the mac out of the box.
Have you tried JewelryBox? It provides a painless install method for rvm and a great little gui that helps you monitor the size of your gem sets, and installs of ruby. Along with helpful reminders to upgrade rvm. I resisted at first using it, because using a GUI made me feel like a noob, but it really is a great little tool, that makes for super easy installs of ruby, and rvm, and consequently rails.
http://jewelrybox.unfiniti.com/

Resources