This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Deleting versions of ruby
I'm trying to uninstall a single version of ruby. The second in this list:
which -a ruby
/Users/snowcrash/.rvm/rubies/ruby-1.9.2-p318/bin/ruby
/Users/snowcrash/.rvm/bin/ruby
However, when I run:
rvm remove
I get:
Really? remove all? See "rvm list known" and limit the selection to something more sane please :)
So, running:
rvm list known
shows a whole list of versions. However, none of these is the one I want to delete, i.e. /Users/snowcrash/.rvm/bin/ruby
E.g.
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p358]
[ruby-]1.8.7-head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2[-p318]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3[-p125]
[ruby-]1.9.3-head
ruby-head
# GoRuby
goruby
# TheCodeShop - MRI experimental patches
tcs
# JRuby
jruby-1.2.0
jruby-1.3.1
jruby-1.4.0
jruby-1.6.5
jruby-1.6.5.1
jruby-1.6.6
jruby[-1.6.7]
jruby-head
# Rubinius
rbx-1.0.1
rbx-1.1.1
rbx-1.2.3
rbx-1.2.4
rbx[-head]
rbx-2.0.testing
# Ruby Enterprise Edition
ree-1.8.6
ree[-1.8.7][-2012.02]
# Kiji
kiji
# MagLev
maglev[-head]
maglev-1.0.0
# Mac OS X Snow Leopard Or Newer
macruby[-0.10]
macruby-nightly
macruby-head
# IronRuby -- Not implemented yet.
ironruby-0.9.3
ironruby-1.0-rc2
ironruby-head
You lack knowledge of rvm:
$ rvm list
...
=* ruby-1.9.3-p327 [ x86_64 ]
...
$ rvm alias list
default => ruby-1.9.3-p327
now what is in the list can be removed:
$ rvm remove 1.9.3
and what is an alias has to be removed as alias:
$ rvm alias delete default
all this information is available at rvm site => https://rvm.io
Aha - figured it out:
rvm uninstall all
Interestingly, this deletes all versions apart from the one I wanted to delete!
which -a ruby
/Users/snowcrash/.rvm/bin/ruby
Related
This issue seems to relate to Default Ruby not loading with RVM, but the answer do not help me.
On my Ubuntu 14 LTS, I've got 2 rubies installed in rvm and set 2.2-head as default using rvm use 2.2-head --default. After reopening terminal (login shell is configured) 2.2 does not get set as current
$ rvm list
rvm rubies
=> ruby-2.1.5 [ x86_64 ]
* ruby-2.2-head [ x86_64 ]
# => - current
# =* - current && default
# * - default
I couldn't find any .ruby-version or .rvmrc in current ($HOME) folder (or its parents).
Meanwhile I tried removing system ruby (1.9.3), but this has no effect, too.
What did I miss?
Problem could be solved by rebooting system, although I don't know why this works
Have you followed the instructions on https://rvm.io/rubies/default?
When I input:
ruby -v
I get:
ruby 1.8.7
but with:
rvm list
I get:
=* ruby-2.2.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
What is causing this mismatch? How do I correct it so I always use 2.2.1?
I would guess there is something wrong with your $PATH and you are referencing the system ruby maybe? I would recommend double checking the install directions.
You could also try running again:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
Finally, once you get that working, I also find using .ruby-version and .ruby-gemset files in repos/folders very helpful. See "Typical RVM Project Workflow" for more info.
RVM doesn't use the default Ruby version on both my Mac and Ubuntu server.
This is what I get when I do rvm list on my Mac:
rvm rubies
* ruby-2.1.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
And what I get on Ubuntu:
rvm rubies
* ruby-2.1.2 [ i686 ]
# => - current
# =* - current && default
# * - default
They are already the default and only version available, but I have to manually type rvm use 2.1.2 each time when I need to do some Ruby stuff. I guess I could put that command into .profile or the like, but it feels hackish since I'm expecting RVM to use the default version.
Does anyone have a better solution?
I resolved the problem.
I tried rvm use ruby-2.1.2 --default multiple times and it didn't work. There's two things I did:
I moved this line:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
in ~/.bash_profile to the last line. See "How to use "RVM --default" on MacOSX".
Somehow some application decided to add itself to this file and making it the first in the path.
Run rvm get head.
This solved the problem for me on my Mac.
I have problem with my gem and Ruby command, I think it's because of path problem.
gem install jekyll
takes for a long time to run, and outputs an error message:
ERROR: Could not find a valid gem 'jekyll' (>= 0)
Unable to download data from https://rubygems.org/ - too many connection resets(https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz)
I entered which ruby, which output:
/usr/local/bin/ruby
If I enter which gem, it prints out:
gem () {
typeset result
(
typeset rvmrc
rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc")
if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
then
rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc")
fi
for rvmrc in "${rvm_rvmrc_files[#]}"
do
[[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
done
unset rvm_rvmrc_files
command gem "$#"
) || result=$?
hash -r
return ${result:-0}
}
Enter whereis gem, prints out:
/usr/bin/gem
Does anyone know how to fix it? I've tried for a long time and get confused.
UPDATE:
Enter gem env I got:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin13.0.0]
- INSTALLATION DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /Users/lijung/.rvm/gems/ruby-1.9.3-p374
- /usr/local/bin/gem
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
enter rvm info:
ruby-1.9.3-p374:
system:
uname: "Darwin chi.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64"
system: "osx/10/x86_64"
bash: "/usr/local/bin/bash => GNU bash, version 4.2.37(2)-release (i386-apple-darwin12.2.0)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.18.3 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "9 months 18 days 11 hours 37 minutes 54 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "x86_64-darwin13.0.0"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin13.0.0]"
homes:
gem: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
ruby: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
binaries:
ruby: "/usr/local/bin/ruby"
irb: "/usr/local/bin/irb"
gem: "/usr/local/bin/gem"
rake: "/usr/local/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
GEM_HOME: "/Users/lijung/.rvm/gems/ruby-1.9.3-p374"
GEM_PATH: "/usr/local/bin/gem"
MY_RUBY_HOME: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374"
IRBRC: "/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/.irbrc"
RUBYOPT: ""
gemset: ""
The first thing I see that is a "really bad thing" when using RVM is:
PATH: "/usr/local/bin:/usr/local/sbin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
Even with how Stack Overflow formats this you can see that the RVM initialization isn't correct. RVM must be the first thing in your path. Look in your ~/.bash_profile or ~/.bashrc file and adjust the PATH manipulations so it comes first, then close the terminal window and reopen it. Checking the PATH should look something like:
"/Users/lijung/.rvm/gems/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/gems/ruby-1.9.3-p374#global/bin:/Users/lijung/.rvm/rubies/ruby-1.9.3-p374/bin:/Users/lijung/.rvm/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/MacOS/bin"
The path is the chain of directories used by your shell when looking for a command. Your current path is telling the shell to find commands in /usr/local/bin and /usr/local/sbin first, which means it will find all Ruby-related commands in that directory first, which are NOT the ones that RVM installed for you.
Fixing the RVM initializer so it runs at the right point in your ~/.bash_profile or ~/.bashrc is the first step.
Your RVM is out of date too. Every couple weeks you should run rvm get stable to make sure you've got the latest settings and bug-fixes. Once your path is straightened out you can run that.
The error:
Unable to download data from https://rubygems.org/ - too many connection resets...
is indicative of internet problems between you and your server. Usually that will be fixed on its own. If it doesn't heal itself in a reasonable time, try restarting your machine, which will give the IP stack a chance to restart and flush all its caches; Though that code is well tested, there are still times it can lose it's mind and do dumb things. The reset is a poke in its eye which gets its attention. If THAT doesn't fix it consider calling your ISP.
I be able to use Ruby, that I've downloaded from brew? How can I set my gem path to the right path?
Deal with things in the right order. You can't use your Ruby as it's currently configured because your gems are not correctly associated with the right Ruby version and any changes you make to the Ruby installations will only result in confusion and mayhem. Once you have the path corrected and RVM running correctly, then it's a very simple RVM command to enable other Homebrew Rubies:
rvm use system --default
At that point, RVM will step out of the way and your other Rubies will be accessible via the PATH chain. You have to manage which Ruby version will be executed at that point.
Avoiding that hassle is why we use RVM or rbenv; They can easily install multiple Ruby versions and let you switch between them with a simple command, or even automatically when you chdir into a directory, if you set them up to do so. Brew only muddies the water, and trying to use a Brew installed Ruby was the source of your problem, so I'd recommend seriously rethinking that decision.
Finally, because you don't seem to understand what you're doing, and you're on Mac OS X, I'd recommend fixing this path problem, then backing away from the computer, READ ALL THE RVM PAGES until you REALLY understand what it does, then carefully make changes. Don't trust what other sites say about installing RVM, trust what the RVM authors say first. The authors know what works best for using it.
You might want to look into using JewelryBox also.
I am trying to install rvm on a vagrant box Ubuntu 12.04. When I run the vagrant script the installation halts due to an error with this command:
curl -L https://get.rvm.io | sudo bash -s stable --ruby=$RUBY_VER --auto-dotfiles --verify-downloads 1
This is the output of that command running inside the vagrant script:
Turning on auto dotfiles mode.
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
Upgrading the RVM installation in /usr/local/rvm/
source /etc/profile.d/rvm.sh
Upgrade of RVM in /usr/local/rvm/ is complete.
Upgrade Notes:
* No new notes to display.
# In case of problems:
# run and read: rvm notes
# read docs: http://rvm.io/
# talk to us: http://webchat.freenode.net/?channels=rvm
# read cheatsheet: http://cheat.errtheblog.com/s/rvm
# watch screencast: http://screencasts.org/episodes/how-to-use-rvm
# open a bug report: https://github.com/wayneeseguin/rvm/issues
# vagrant,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and more enjoyable!
!!
#
# ~Wayne
rvm 1.21.6 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <m
papis#gmail.com> [https://rvm.io/]
Searching for binary rubies, this might take some time.
.o binary rubies available for: ubuntu/12.04/i386/ruby-1.9.3-p374
Continuing with compilation. Please read 'rvm help mount' to get more informatio
n on binary rubies.
Installing requirements for ubuntu, might require sudo password.
Requirements installation successful.
, this may take a while depending on your cpu(s)...es/ruby-1.9.3-p374
, this may take a while depending on your connection...
.tar.bz2', it's not possible to validate it.ng.org/pub/ruby/1.9/ruby-1.9.3-p374
This could be because your RVM install's list of versions is out of date. You ma
y want to
update your list of rubies by running 'rvm get stable' and try again.
If that does not resolve the issue and you wish to continue with unverified down
load
add '--verify-downloads 1' after the command.
There has been an error fetching the ruby interpreter. Halting the installation.
However when I try to run the same instruction on the command line of the vagrant box it seems to work:
vagrant#precise32:~$ curl -sSL https://get.rvm.io | sudo bash -s stable --ruby=1.9.3-p374 --auto-dotfiles --verify-downloads 1
The output is this:
Turning on auto dotfiles mode.
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
Upgrading the RVM installation in /usr/local/rvm/
Upgrade of RVM in /usr/local/rvm/ is complete.
Upgrade Notes:
* No new notes to display.
# In case of problems:
# run and read: rvm notes
# read docs: http://rvm.io/
# talk to us: http://webchat.freenode.net/?channels=rvm
# read cheatsheet: http://cheat.errtheblog.com/s/rvm
# watch screencast: http://screencasts.org/episodes/how-to-use-rvm
# open a bug report: https://github.com/wayneeseguin/rvm/issues
# vagrant,
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne
rvm 1.21.6 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
Already installed ruby-1.9.3-p374.
To reinstall use:
rvm reinstall 1.9.3-p374
Creating alias default for ruby-1.9.3-p374.
Recording alias default for ruby-1.9.3-p374.
Creating default links/files
Saving wrappers to '/usr/local/rvm/bin'........
* To start using RVM you need to run `source /usr/local/rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Any ideas? I guess I could run manually the instructions on the vagrant files one by one but it would ruin the entire purpose of using provisioning. Thanks in advance.
Nevermind. It happened that my Git was configured to convert line ending from Linux to Windows format automatically, so when I downloaded the vagrant files they turned useless when Linux tried to extract Ruby version (and other stuff like that) from them.
So the solution in my case was to reinstall Git, setting "Configuring the line ending conversions" to "Checkout as-is, commit as-is":