RVM won't install Rails to system - ruby-on-rails

I've tried the following commands:
rvm system gem install rails
rvm system install rails
rvmsudo gem install rails
sudo gem install rails
After one of these commands, I get a message telling me to run sudo gem install rails. But it doesn't work.
I had no problems before to install rails on rvm 1.9.2 the Mac OSX 10.6.8 version.
Could anyone help me with that?

If you've installed rvm successfully, test with rvm info so that it returns output then you just need to do gem install rails to install rails into the ruby version you are using with RVM - no sudo required. Have I misunderstood?

First check either rvm install properly or not using this command
rvm --help
then install rails by this command
gem install rails -v=3.2.1
Or any version you want..

If you don't have ruby 1.9.3 then use:
$ rvm install 1.9.3
or you may start from this:
$ rvm use 1.9.3
$ rvm gemset create rails313
$ rvm use 1.9.3#rails313 --default
$ gem install rails -v 3.1.3
note: I use 1.9.3 as an example you can use other ruby version also.

Follow the documentation. Make sure you've got the necessary system requirements via rvm requirements. Unless you've got some bizarre user permissions in $HOME, there is no reason to use sudo w/ rvm on your system.

make sure you have installed build_essentials, also try rvm requirements, which gives all dependencies, install all using rvmsudo command
See also: Installing Ruby on Rails - Mac OS Lion

First check whether all dependencies are satisfied by running:
$ rvm requirements
next:
$ rvm install ruby
next:
$ gem install rails
Note: You may have to use sudo or rvmsudo before the commands depending on whether its system-wide install or user specific.

Related

Can't update Ruby resulting in Rails error

I checked the list for http://railsapps.github.io/installrubyonrails-mac.html trying to reinstall Rails and have been trying to update it for the last 2+ hours.
This is what I get at the terminal:
Stevens-MBP:Desktop Steven$ rvm install ruby-2.3.1
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.11/x86_64/ruby-2.3.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
==> Upgrading 1 outdated package, with result:
automake 1.15
Error: You must `brew link autoconf` before automake can be installed
Requirements installation failed with status: 1.
Here is additional information:
Stevens-MBP:Desktop Steven$ rails -v
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.
Stevens-MBP:Desktop Steven$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
Stevens-MBP:Desktop Steven$
When I type sudo gem install rails I get:
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
sudo gem install rails
Rule #1 when working with RVM (or rbenv) is do NOT use sudo except for multi-user installs (which are not encouraged by the maintainers).
By default, RVM and rbenv manage Rubies installed using them in a separate folder in your home directory where you already have full privileges to install/update/remove Rubies or gems. Use whichever manager you want to install/remove Ruby and set it as a default, then use gem install ... to install gems.
Using sudo changes your effective user to the sysadmin, which has a different idea where the RVM/rbenv managed Rubies and the associated gems live.
After issuing rvm install ruby-2.3.1 you should do
rvm use 2.3.1 --default
to tell RVM which Ruby you want to use.
rvm info will tell you what RVM knows about its world.
The error you get is probably because your vendor-installed version of Rails is out of date, and sudo is the root-cause of that occurring. Try gem install rails and you should be OK.
First upgrade ruby with rvm upgrade 2.1.2 2.3.1
That should do the trick if you have rvm installed correctly. Once it's done you can install rails with sudo gem install rails

Setting up a Ruby on Rails environment, made a change with RVM now Rails won't work.

I'm trying to setup RoR on my system. I've used the instructions here http://railsapps.github.io/installrubyonrails-mac.html
I'm getting stuck because I was finally able to get Rails installed, but after I set the Ruby version, it won't detect rails anymore
CJs-MacBook-Air:~ cjwheelock$ rails -v
Rails 4.0.1
CJs-MacBook-Air:~ cjwheelock$ rvm use ruby-2.0.0#learn-rails --create
Warning! PATH is not properly set up, '/Users/cjwheelock/.rvm/gems/ruby-2.0.0-p353/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p353'.
Using /Users/cjwheelock/.rvm/gems/ruby-2.0.0-p353 with gemset learn-rails
CJs-MacBook-Air:~ cjwheelock$ rails -v
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.
CJs-MacBook-Air:~ cjwheelock$ gem install rails
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
Any help would be greatly appreciated. Hopefully my formatting is readable, its my first time posting here.
Thank you.
Have you tried rvm get stable --auto-dotfiles ?
First restart terminal.
# rvm list
# rvm use 2.0.0-pXXX --default (XXX is the biggest number)
# gem install rails
If you will have some problems, install requirements(openssl, etc... : type below for more infomation)
# rvm requirements
install deb packages
# sudo apt-get install blaaaaaaaa
reinstall ruby 2.0.0
# rvm reinstall 2.0.0
and try first step.
Good Luck

Why do I get "write permission" errors installing Rails?

When I use rvm use 1.9.2, I get Rails v3.0.0:
vikas#admin1-DL-H61MXEL:~$ rvm use 1.9.2 --default
Using /home/vikas/.rvm/gems/ruby-1.9.2-p320
vikas#admin1-DL-H61MXEL:~$ rails -v
Rails 3.0.0
When I use rvm use 2.0.0, I get Rails v3.2.13:
vikas#admin1-DL-H61MXEL:~$ rvm use 2.0.0
Using /home/vikas/.rvm/gems/ruby-2.0.0-p195
vikas#admin1-DL-H61MXEL:~$ rails -v
Rails 3.2.13
I need Rails v3.2.13 with Ruby 1.9.2.
When I used rvm use 1.9.2 --default and gem install rails -v 3.2.13, I got the following error:
While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /home/vikas/.rvm/gems/ruby-1.9.2-p320/bin directory.
This is the error I'm facing now.
The most likely reason you're getting the error:
(Gem::FilePermissionError) You don't have write permissions into the /home/vikas/.rvm/gems/ruby-1.9.2-p320/bin directory.
Is because, at some point, you used sudo or were running as root when you use RVM to install a gem. When that happened, the ownership of files and/or folders changed to root's permissions, which you can't override running as you.
You don't want to run as root, or use sudo EVER when running rvm or gem commands if you have a RVM installation to provide Ruby in a sandbox in your home directory.
To fix this, try this command:
sudo chown -R vikas ~/.rvm
That will use sudo to change ownership of all files in the ~/.rvm directory to your own account, from the "root" user. This will take at least a few seconds so let it run.
Once that has run, you should be able to switch to each of your Rubies and delete the installed Rails:
rvm use 1.9.2
gem uninstall rails
gem install rails -v 3.2.13
Then:
rvm use 2.0.0
gem uninstall rails
gem install rails -v [whatever version you want]
gem install rails -v
rvm use 1.9.2 --default Using /home/vikas/.rvm/gems/ruby-1.9.2-p320
gem install rails -v 3.2.13
rvm is software tool by which you can manage multiple version of rubies on your system.
for each ruby version you can create a gemset which is just a group of gems.
each ruby version you install has a 'default' gemset.
and it seems that you have installed rails 3.0 for ruby 1.9.2 and rails 3.2.13 for ruby 2.0
you can create your own gemset by command
rvm gemset create rails3
this will create a gemset named 'rails3' and to use it you have to do
rvm gemset use rails3
and in this gemset you can install any version of rails you want.
with command
gem install rails -v='3.2.13'
for more info see rvm doc.
https://rvm.io/

Rails Installation Error in ubantu12.04

I have already installed Ruby 1.9.3,gem 1.8.24, using RVM in ubantu 12.04. But when I instll rails using gem using command gem install rails , then rails is installed with following message:Successfully installed rails-3.2.6
1 gem installed
Installing ri documentation for rails-3.2.6...
Installing RDoc documentation for rails-3.2.6...
But when I check the version of rails then following error occurThe program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
I need help. Thank you?
rvm use 1.9.3 --default
gem install rails
Then run rails -v
Try this:
run this command
source /etc/profile
Then, run rails -v
First try with
rvm list
to get all ruby version then run following cmd to set one of ruby as default
First you have to set
rvm use 1.9.3 --default
Then try cmd
rails -v

Remove Ruby and Rails from my system?

i got several problem runnings ruby and rails. I installed ruby via Macports. How to I remove everything and reinstall everything from the ground up?
Thanks,
To uninstall from MacPorts:
port uninstall ruby
I recommend installing rvm and using it to manage all of your ruby versions. Start here: http://rvm.beginrescueend.com/
Once you have it installed, reload your shell and type:
rvm install ruby-1.9.2
Once that is done, type
rvm use ruby-1.9.2 --default
This will replace your system ruby with the rvm 192 version. Feel free to install any other versions and switch to them using rvm list and rvm use.
For me this code worked very well sudo apt-get autoremove ruby

Resources