Coder Social home page Coder Social logo

rvm-gem's Introduction

Tests GPG signature check OpenCollective OpenCollective

What's RVM

RVM is the acronym of Ruby enVironment Manager. It manages Ruby application environments and enables switching between them.

Homepage and more info at https://rvm.io

Table of Contents

Installing RVM

Ubuntu

RVM have dedicated Ubuntu package, so please follow instructions posted here: https://github.com/rvm/ubuntu_rvm

If you need a different (newer) version of RVM, after installing base version of RVM check the Upgrading section below.

Any other operating system

Make sure you have following required packages installed:

  • curl
  • gpg2

And then run:

\curl -sSL https://get.rvm.io | bash -s stable

Additional installation options

Additional installation options and details about the installation process are described here: https://rvm.io/rvm/install

Upgrading RVM

You can upgrade RVM any time by running:

rvm get VERSION

Where VERSION should be replaced by one of the following values:

  • stable - latest stable RVM (good for servers)
  • master - latest RVM (might not be stable)
  • branch /path/branch - branched version of RVM (for testing new features or bug fixes)

Additional upgrading options are described here: https://rvm.io/rvm/upgrading

Basic RVM usage

Basic RVM usage scenarios include installing and switching between different ruby versions.

Installing ruby

To install ruby you have to call rvm install INTERPRETER[-VERSION] OPTIONS

When no version specified, RVM will install latest stable version or selected interpreter. If you omit to specify interpreter, RVM will assume that you wanted to install MRI ruby. Following examples would have exactly the same effect:

rvm install ruby-2.3.1
rvm install ruby-2.3
rvm install 2.3.1
rvm install 2.3

Passing additional --default option makes selected ruby your default.

We currently supported following ruby interpreters:

  • ruby - MRI ruby (The Gold Standard)
  • ironruby - a .NET ruby
  • jruby - Java implementation of the ruby
  • macruby - implementation of ruby 1.9 directly on top of macOS core technologies
  • maglev - 64-bit implementation on top of VMware's GemStone
  • mruby - lightweight ruby
  • opal - ruby to JavaScript compiler
  • rbx - Rubinius - a next generation virtual machine VM for ruby
  • topaz - high performance ruby, written in RPython
  • truffleruby - high performance ruby using GraalVM

Historical interpreters which you can still install with RVM, but are not anymore developed and supported by their authors:

  • ree - Ruby Enterprise Edition - MRI Ruby with several custom patches for performance, stability, and memory

Switching between ruby versions

To switch between ruby versions you should call

rvm use INTERPRETER[-VERSION]

Same rules and options apply as for install command with two special interpreters.

  • default - default ruby (or the system ruby if a default hasn't been set)
  • system - system ruby (state before RVM was installed)

Additionally you might want to list your preferred ruby version in a .ruby-version file stored in your project folder. This would cause automatic switch to selected ruby whenever you enter the folder.

Other RVM commands

RVM comes bundled with many different tools for managing your ruby environment. More detailed information about every command listed below can be read after executing rvm help COMMAND or browsing documentation on RVM homepage https://rvm.io.

Reporting issues

Here at RVM we get a high amount of bug reports, and often they are connected with specific environment settings which might be hard for us to replicate. That's why we would kindly ask you to follow the steps below so we can maximize our time helping you and minimize the time requesting more information.

Check documentation

We know, you hear this over and over and be rest assured we are working hard to improve the usability of https://rvm.io but we must always ask that you first please check the documentation if you are requesting a feature or if you are not sure if you did it right.

Try again with latest RVM

We try to release a new RVM as soon as we feel that we achieved certain stability. This might take a while and it could be the case that your issue has been already resolved in our development branch. Please get the latest RVM and try again:

rvm get master

File an issue

If the documentation is not clear, an error message is not clear or you are stuck with the problem, please do file a bug.

When in doubt as to whether your issue might relate to another, simply file a new bug, and we will mark it as duplicate if it needs to be. It's always better to file a new ticket and let us sort it out than to accidentally add noise to another ticket.

For filing issues, we have prepared a template for you to use. Please try to fill all sections as best as you can. Always make sure to split up each command and its output into its own fenced code block. If the output is long, please put it in a separate gist. Otherwise it's hard for us to process all the information and respond quickly.

Note that if there is a lot of debug or trace output you can redirect it to a file with the > character like rvm [command] > output.txt.

Contributing

You are very warmly welcome to help. Please follow our contribution guidelines

Any and all contributions offered in any form, past present or future are understood to be in complete agreement and acceptance with our Apache License v2.0.

Backers

Become a backer and support us with a small monthly donation to help us continue our activities. Thank you if you are already one of them! ๐Ÿ™

Backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

Sponsors

License

Copyright (C) Michal Papis (2011-2021), Piotr Kuczynski (2016-2021), Wayne E. Seguin (2009-2011)

Licensed under the Apache License, Version 2.0

rvm-gem's People

Contributors

chrblabla avatar dqminh avatar fnichol avatar lenny avatar lunks avatar mpapis avatar nickmarden avatar tildewill avatar wayneeseguin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rvm-gem's Issues

gem fails to install with 'invalid byte sequence in US-ASCII'

I'm having an issue installing the latest version of the gem (1.11.3.2). Here's the output with backtrace:

ubuntu@machine:~$ sudo gem install rvm --backtrace
ERROR:  While executing gem ... (ArgumentError)
    invalid byte sequence in US-ASCII
    /usr/lib/ruby/1.9.1/rubygems/specification.rb:519:in `normalize_yaml_input'
    /usr/lib/ruby/1.9.1/rubygems/specification.rb:479:in `from_yaml'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_input.rb:183:in `load_gemspec'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_input.rb:51:in `block in initialize'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:64:in `block in each'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `loop'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_reader.rb:55:in `each'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_input.rb:32:in `initialize'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `new'
    /usr/lib/ruby/1.9.1/rubygems/package/tar_input.rb:17:in `open'
    /usr/lib/ruby/1.9.1/rubygems/package.rb:58:in `open'
    /usr/lib/ruby/1.9.1/rubygems/format.rb:63:in `from_io'
    /usr/lib/ruby/1.9.1/rubygems/format.rb:51:in `block in from_file_by_path'
    /usr/lib/ruby/1.9.1/rubygems/format.rb:50:in `open'
    /usr/lib/ruby/1.9.1/rubygems/format.rb:50:in `from_file_by_path'
    /usr/lib/ruby/1.9.1/rubygems/installer.rb:118:in `initialize'
    /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:264:in `new'
    /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:264:in `block in install'
    /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:247:in `each'
    /usr/lib/ruby/1.9.1/rubygems/dependency_installer.rb:247:in `install'
    /usr/lib/ruby/1.9.1/rubygems/commands/install_command.rb:119:in `block in execute'
    /usr/lib/ruby/1.9.1/rubygems/commands/install_command.rb:116:in `each'
    /usr/lib/ruby/1.9.1/rubygems/commands/install_command.rb:116:in `execute'
    /usr/lib/ruby/1.9.1/rubygems/command.rb:270:in `invoke'
    /usr/lib/ruby/1.9.1/rubygems/command_manager.rb:134:in `process_args'
    /usr/lib/ruby/1.9.1/rubygems/command_manager.rb:104:in `run'
    /usr/lib/ruby/1.9.1/rubygems/gem_runner.rb:58:in `run'
    /usr/bin/gem:21:in ''

I am running stock 1.9.2 on ubuntu 11.10 oneiric.

ubuntu@machine:~$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
ubuntu@machine:~$ gem -v
1.3.7

I can install version 1.11.3, but not 1.11.3.1 or 1.11.3.2:

ubuntu@machine:~$ sudo gem install rvm -v=1.11.3.1
ERROR:  While executing gem ... (ArgumentError)
    invalid byte sequence in US-ASCII
ubuntu@machine178:~$ sudo gem install rvm -v=1.11.3
***********************************************************************************
...
Successfully installed rvm-1.11.3
1 gem installed
Installing ri documentation for rvm-1.11.3...
Installing RDoc documentation for rvm-1.11.3...

I am, however, able to install both of these troublesome versions without issue on my local machine that is running 1.9.3-p0 installed via rvm.

add rvmrc_create method

I'm using the API in a Rails application template to set up an rvm gemset when an application is created with the rails new -m command. I appreciate being able to use the API method RVM.gemset_create app_name. I also want to create a .rvmrc file using the API. I can do this in my application template using Thor commands:

  create_file '.rvmrc' do
    "rvm #{rvm_env}"
  end

but I like the full-featured .rvmrc file I get when I use $ rvm --rvmrc --create ruby-1.9.3-p194@myapp in the shell.

I was expecting to be able to use an API method like RVM.rvmrc_create "default@mygemset" but after scanning the source code I don't see any methods to create an .rvmrc file in the API. Did I overlook it or is it missing? Would it make sense to add it?

Possible to Require Old Versions

Not sure if this is a bug, but it caused some inconsistencies in our deploy process with different team members (we ran cap deploy instead of bundle exec cap deploy)

*** LOCAL GEMS ***

rvm (1.11.3.3, 1.9.2)
Kens-MacBook-Pro:campaign_manager kmazaika$ irb
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
re => true 
1.9.3-p0 :003 > require 'rvm'
 => true 
1.9.3-p0 :004 > RVM::Version
 => "1.11.3.3" 
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
re => true 
1.9.3-p0 :003 > require 'rvm'
 => true 
1.9.3-p0 :004 > RVM::Version
 => "1.11.3.3" 
1.9.3-p0 :005 > exit
Kens-MacBook-Pro:campaign_manager kmazaika$ irb
1.9.3-p0 :001 > require 'rubygems'
 => false 
1.9.3-p0 :002 > require 'capistrano'
 => true 
1.9.3-p0 :003 > require 'rvm/capistrano'
LoadError: Please require this file from within a Capistrano recipe
    from /Users/kmazaika/.rvm/gems/ruby-1.9.3-p0@campaign_manager/gems/capistrano-2.12.0/lib/capistrano/configuration/loading.rb:18:in `instance'
    from /Users/kmazaika/.rvm/gems/ruby-1.9.3-p0@campaign_manager/gems/rvm-1.9.2/lib/rvm/capistrano.rb:7:in `<top (required)>'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from (irb):3
    from /Users/kmazaika/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'
1.9.3-p0 :005 > require 'rvm'
 => true 
1.9.3-p0 :006 > RVM::Version
 => RVM::Version 
1.9.3-p0 :007 > RVM::VERSION
 => "1.9.2" 

This caused some members on our team who had the old version of the rvm gem on their machine to be able to deploy successfully (because it would fallback to the old version), but users who did not have the old version of the gem to see an error message.

It might make sense to add a file into rvm such that:

require 'capistrano/rvm' will raise an error (instead of falling back to 1.9.2).

source_command_wrapper should fail loudly

Hi guys,

I've spend my morning tracking down an error in chef-rvm. It was caused by wrong permission rights on the command_wrapper, due to which it could not be sourced.

Tracking down this error was quite hard, mainly because source_command_wrapper failed silently. As far as I see it, the rvm-gem cannot function without the wrapper, is this correct? If so, I suggest to make it raise an exception if errors occur during sourcing.

What do you think?

Robin

Documentation URL is no longer good

The URL https?://rvm.beginrescueend.com is referred to in the in-line documentation and is the "Documentation" link on rubygems.org. The URL is also part of the Github description for this project. The "rvm" subdomain redirects to the parent, which is a blog in German, which is not the documentation that I expect.

fails with Ruby 2.2.3 but not Ruby 2.2.2

I use the rvm gem (version 1.11.3.9) in Rails Composer to generate a project-specific rvm gemset.

I've got Ruby 2.2.2 (installed with RVM) and Rails Composer works fine:

$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
.
.
.
Use or create a project-specific rvm gemset? (y/n) y
.
.
.
(success)

I recently installed Ruby 2.2.3 and Rails 4.2.5 and Rails Composer fails:

$ rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
.
.
.
Use or create a project-specific rvm gemset? (y/n) y
.
.
.
recipe creating project-specific rvm gemset and .rvmrc
https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2606:
in `rescue in apply': RVM gem is currently unavailable. (RuntimeError)
    from https://raw.github.com/RailsApps/rails-composer/master/composer.rb:2600:in `apply'

Here's the code that uses the rvm gem:

if prefs[:rvmrc]
  if which("rvm")
    say_wizard "recipe creating project-specific rvm gemset and .rvmrc"
    # using the rvm Ruby API, see:
    # http://blog.thefrontiergroup.com.au/2010/12/a-brief-introduction-to-the-rvm-ruby-api/
    # https://rvm.io/integration/passenger
    if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
      begin
        gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
        ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
        require 'rvm'
        RVM.use_from_path! File.dirname(File.dirname(__FILE__))
      rescue LoadError
        raise "RVM gem is currently unavailable."
      end
    end
    say_wizard "creating RVM gemset '#{app_name}'"
    RVM.gemset_create app_name
    say_wizard "switching to gemset '#{app_name}'"
    # RVM.gemset_use! requires rvm version 1.11.3.5 or newer
    rvm_spec =
      if Gem::Specification.respond_to?(:find_by_name)
        Gem::Specification.find_by_name("rvm")
      else
        Gem.source_index.find_name("rvm").last
      end
      unless rvm_spec.version > Gem::Version.create('1.11.3.4')
        say_wizard "rvm gem version: #{rvm_spec.version}"
        raise "Please update rvm gem to 1.11.3.5 or newer"
      end
    begin
      RVM.gemset_use! app_name
    rescue => e
      say_wizard "rvm failure: unable to use gemset #{app_name}, reason: #{e}"
      raise
    end
    if File.exist?('.ruby-version')
      say_wizard ".ruby-version file already exists"
    else
      create_file '.ruby-version', "#{RUBY_VERSION}\n"
    end
    if File.exist?('.ruby-gemset')
      say_wizard ".ruby-gemset file already exists"
    else
      create_file '.ruby-gemset', "#{app_name}\n"
    end
  else
    say_wizard "WARNING! RVM does not appear to be available."
  end
end

Has something changed? Does the rvm gem still work with Ruby 2.2.3?

gemset_use!

Hi.

Just to notice, there's always the bug with method 'gemset_use!' in lib/rvm/environment/gemset.rb:86

It just don't work with rails templates (result[:rvm_env_string] is nil).
I saw it was fixed in older version but it's still here

see here: rvm/rvm#449
or here: rvm/rvm#458

I manually fix the problem but now I need to build ruby configurations automatically (intent to migrate my co-workers from php to ruby) and I can't just fix it with scripts (path names depends on which ruby version is installed).

Thank you for your time.
Best regards.

use and run_command don't work in rails console or rake

running the following works in IRB but not rails console or rake
env = RVM::Environment.new('system')
env.shell_wrapper.run_command("cd ~/opscode/FTW && knife rackspace server list")

output shows:

[false, "", "/home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `materialize': Could not find multi_json-1.2.0 in any of the sources (Bundler::GemNotFound)\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/setup.rb:17\n/home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `materialize': Could not find multi_json-1.2.0 in any of the sources (Bundler::GemNotFound)\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'\n\tfrom /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/setup.rb:17\n"]

->

/home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `materialize': Could not find multi_json-1.2.0 in any of the sources (Bundler::GemNotFound)
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
    from /home/hunter/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/setup.rb:17

my first guess is it has to do with bundler... i'll update if i find anything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.