I have latest RVM installed in OX 10.9.
$ rvm rubies
* ruby-1.9.3-p545 [ x86_64 ]
=> ruby-2.1.1 [ x86_64 ]
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/rajveershekhawat/.rvm/gems/ruby-2.1.1)
(default)
global
rails403
rails404
=> rails410
After this i installed rails.
$ gem install rails -v 4.1.0
It got installed. It is also there in correct location within .rvm folder. But when I try using it, system says rails is not installed.
$ 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.
I have tried it twice and still unable to figure out what am I am missing. Please help.
Thanks.
This question is similar but is not helping.
Edits:
$ gem list | grep rails
rails (4.1.0)
sprockets-rails (2.1.3)
$ echo $PATH
/Users/rajveershekhawat/.rvm/gems/ruby-2.1.1#rails410/bin:/Users/rajveershekhawat/.rvm/gems/ruby-2.1.1#global/bin:/Users/rajveershekhawat/.rvm/rubies/ruby-2.1.1/bin:/Users/rajveershekhawat/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Update:
Seems like the rails was not properly installed before. I recreated the gemset and tried to intall rails again but got some error. Then I again emptied the gemset and reinstalled rails with sudo. This resolved the issue.
Try to run:
rvm use ruby-2.1.1#rails410
gem list
Can you find Rails here?
Why did you call sudo gem install rails, cant be this the problem, you do not need to use sudo.
Related
Show messages errors:
Required ruby-2.6.1 is not installed.
To install do: 'rvm install "ruby-2.6.1"'
ruby -v
ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32]
rails -v
Rails 5.2.2
First of all, I doubt that RVM may not be updated to support this version of Ruby. As I know the following version is supported, you can version by following command and response should match.
rvm --version
1.29.7
If you have updated version then I will do the following to check if RVM has also the same version of ruby installed.
I will check the content of my project root folder's following file
cat .ruby-version
If it has mention same, as rvm is also complaining that I will run the following command on rvm to check if this ruby is really installed in RVM
rvm list
It will show a list of rubies installed and it should include 2.6.1 in the end. If you can't see this list then you probably need to install using the following command
rvm install "ruby-2.6.1"
If it is showing than can you try the following command and see what result comes
rvm use 2.6.1
If all good, then try the following command to see which ruby is being used
which ruby
response must include .rvm/rubies/ mean you are using .rvm ruby otherwise, you may using the system built in ruby.
Just wrote may help you to diagnos issue.
Are you using rbenv? If so, I'd recommend running rvm implode as described here.
if you are using rbenv
see if you have it available in your list :
rbenv install --list | grep 2.6.1
if not, fetch it
cd ~/.rbenv/plugins/ruby-build && git pull && cd -
now if you try again
rbenv install -l | grep 2.6.1
so just run the installation command:
rbenv install 2.6.1
Downloading ruby-2.6.1.tar.bz2... 08:36:17
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.1.tar.bz2
Installing ruby-2.6.1...
Installed ruby-2.6.1 to ~/.rbenv/versions/2.6.1
now you can use it for global or local projects. if local :
rbenv local 2.6.1
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
I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:
ERROR: While executing gem ... (Errno::EEXIST)
File exists # dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`
How do I correct this error?
I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.
I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.
for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.
When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:
$ pwd
Navigate to the folder where you created your Rails project using the Unix cd command, for example:
$ cd workspace/learn-rails
If you are using RVM, make sure you have selected the correct gemset:
$ rvm gemset list
gemsets for ruby-2.1.1 (found in ...)
(default)
global
=> learn-rails
Then see if Ruby and Rails are installed:
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0
Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.
I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists # dir_s_mkdir" error. Even tried MacPort and that was a nightmare.
First uninstall ruby via
brew uninstall ruby
or
port uninstall ruby
And follow the instruction on https://rvm.io/rvm/install to install ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
It might then complain about ruby-2.0.0-p353 not installed
To install do:
rvm install ruby-2.0.0-p353
Then run the rvm install script. Your "gem install << whatever >>" should now work
This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):
$ brew reinstall ruby
$ brew unlink ruby && brew link ruby
the same issue. I just remove dir_s_mkdir, then pod install. it works for me!
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/
I am trying to install Rails into a new rvm gemset.
I tried the following:
rvm gemset create rails-4.0
output: gemset created rails-4.0
Next I did:
rvm 2.0.0#rails-4.0
rvm gemset list:
gemsets for ruby-2.0.0-p0 (found in /Users/me/.rvm/gems/ruby-2.0.0-p0)
(default)
global
=> rails-4.0
rails -v
Rails is not currently installed on this system. To get the latest
version, simply type:
$ sudo gem install rails
Do the rvm commands I listed not install rails 4.0?
This command:
rvm gemset create rails-4.0
is creating basically a directory structure to hold the gems. You could have just as easily called it something other than "rails-4.0" like "foo" and it would be the same behavior.
This command:
rvm 2.0.0#rails-4.0
Switches to Ruby 2.0.0 and tells it to use the new gemset named rails-4.0. Again, that could be "foo" or whatever you called it.
Now, to get Rails 4.0.x, you'd do:
gem install rails --version=4.0
As Barrett pointed out earlier, to get a pre/beta/rc release, you can specify the whole version string, e.g. gem install rails --version=4.0.0.rc2.
Don't sudo, because you shouldn't sudo with rvm, even though it tells you to. With the "system ruby" (ruby not installed by rvm), it may be installed as root, so you need superuser (su) access (superuser do or "sudo") to do that. But, rvm has you install things as the current user, therefore you don't need to sudo.
In addition to the usage tips above, if you don't specify the gem version you won't get the beta or pre version, so to get rails 4, you need:
gem install rails --version=4.0.0.rc1
Maybe try InstallRails?
http://installrails.com/ is a guide for installing rails that deals with these issues for various Operating Systems and setups. It might prove helpful for something like this.
Other answers shows instructions for creating the gemset using default ruby version.
For creating a gemset and use it with different ruby version please follow the instructions below:
Let's say on my machine I have following ruby versions installed and 2.2.0 is the default.
=*ruby-2.2.0 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
ruby-2.2.3 [ x86_64 ]
Now I have forked a repository from Github and want to test out the repo's code with Rails 5 (edge version) and Ruby 2.2.3 (the latest stable version at the time of this writing). And I prefer using gemsets so I ran following commands:
rvm use 2.2.3#forked-repo --create
That's actually a shortcut for
rvm 2.2.3
rvm gemset create forked-repo
Next I would run following command to install bundler:
forked_repo_root$ gem install bundler
forked_repo_root$ bundle
That should install the gems used in your forked-repo in the gemset created above.
Reference: https://rvm.io/gemsets/creating