Install a new version of Ruby (Rbenv documentation on GitHub--)

Source: Internet
Author: User
Tags using git


Https://github.com/sstephenson/rbenv

  • Check out rbenv into ~/.rbenv .
    $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  • Add to your for access to the ~/.rbenv/bin $PATH rbenv command-line utility.
    $ Echo ' Export path= ' $HOME/.rbenv/bin: $PATH "' >> ~/.bash_profile

    Ubuntu Desktop Note: Modify your ~/.bashrc instead of ~/.bash_profile .

    Zsh Note: Modify your ~/.zshrc file instead of ~/.bash_profile .

  • Add to rbenv init your shell to enable shims and autocompletion.
    $ Echo ' eval ' $ (rbenv init-) "' >> ~/.bash_profile

    Same as in previous step, use on ~/.bashrc Ubuntu, or for ~/.zshrc Zsh.

  • Restart your shell So, PATH changes take effect. (Opening a new terminal tab would usually do it.) Now check if Rbenv is set up:
    $ type rbenv#=> "Rbenv is a function"
  • (Optional) Install Ruby-build, which provides the rbenv install command that simplifies the process ofinstalling new Ruby versions.

Upgrading

If you've installed rbenv manually using Git, you can upgrade your installation to the cutting-edge version at any time.

$ cd ~/.rbenv$ git pull

To use a specific release of rbenv, check out the corresponding tag:

$ cd ~/.rbenv$ git fetch$ git checkout v0.3.0--------------------------------------------

$rbenv Install--list If you don't see the version you want to install
$CD ~/.rbenv
$git Pull
$CD Plugins
$CD Ruby-build
$git Pull
$rbenv Install--list
$rbenv Install 2.1.2

========== If you can't download the =

View Https://github.com/sstephenson/ruby-build#readme

Package Download Caching

You can instruct Ruby-build to keep a local cache of downloaded package files by setting the environment RUBY_BUILD_CACHE_PATH variable. When set, package files would be kept in this directory after the first successful download and reused by subsequent Invoca tions of ruby-build and rbenv install .

rbenv installthe command defaults this path ~/.rbenv/cache to, so in the most cases you can enable download caching simply by creating that Di Rectory.

Create a new cache folder and manually download the installation package

2001 CD ~/.rbenv/
2002 LL
2003 MKDIR Cache
2004 CD Cha
2005 CD cache/
2006 Wget http://ruby.taobao.org/mirrors/ruby/ruby-2.2.2.tar.gz
cd
Rbenv Install 2.2.2-v

=====================


$ruby-V
$rbenv Global 2.1.2
$rbenv versions
There is one other way
$export rbenv_version=2.1.2
However, this method is only valid in the current terminal window
$gem Install Rails
At this point, we find that the speed is super slow
$gem List
$gem source-l
Come to the web to see the ruby.taobao.org, and then follow the web prompt operation
$gem sources--remove http://rubygems.org/
....
$gem Install Rails

Install a new version of Ruby (Rbenv documentation on GitHub--)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.