博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
安装ruby新版本(github上的rbenv文档--)
阅读量:6870 次
发布时间:2019-06-26

本文共 2345 字,大约阅读时间需要 7 分钟。

  • Check out rbenv into ~/.rbenv.
    $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  • Add ~/.rbenv/bin to your $PATH for access to the 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 rbenv init to your shell to enable shims and autocompletion.
    $ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

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

  • Restart your shell so that PATH changes take effect. (Opening a new terminal tab will usually do it.) Now check if rbenv was set up:
    $ type rbenv#=> "rbenv is a function"
  • (Optional) Install , which provides the rbenv install command that simplifies the process of.

 

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     如果发现没有自己想要装的版本

$cd ~/.rbenv
$git pull
$cd plugins
$cd ruby-build
$git pull
$rbenv install --list
$rbenv install 2.1.2

==========如果这时候下载不了====

查看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 theRUBY_BUILD_CACHE_PATH environment variable. When set, package files will be kept in this directory after the first successful download and reused by subsequent invocations of ruby-build and rbenv install.

The rbenv install command defaults this path to ~/.rbenv/cache, so in most cases you can enable download caching simply by creating that directory.

新建个cache文件夹,手动下载安装包

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
2007 cd 
2008 rbenv install 2.2.2 -v

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

$ruby -v
$rbenv global 2.1.2
$rbenv versions
还有一种方式是
$export RBENV_VERSION=2.1.2
但是这种方式只在当前终端窗口有效
$gem install rails
这时候会发现速度超级慢,
$gem list
$gem source -l
来到网页看一下吧 ruby.taobao.org,接着按照网页提示操作
$gem sources --remove http://rubygems.org/
....
$gem install rails

转载于:https://www.cnblogs.com/iwangzheng/p/4599392.html

你可能感兴趣的文章
深入浅出Linux设备驱动编程--定时器
查看>>
常见移动设备的 CSS3 Media Query 整理(iPhone/iPad/Galaxy/HTC
查看>>
java递归-迷宫求解
查看>>
springboot加载顺序
查看>>
python chapter 学习之序列
查看>>
GlusterFS的基础应用
查看>>
ORA-09925: Unable to create audit trail file Linux-x86_64
查看>>
如何跳出嵌套语句之return
查看>>
API概述
查看>>
python2.6 安装rsa的包
查看>>
undo表空间使用率过高,且迟迟不释放问题
查看>>
scons *** no sconstruct file found求解决办法
查看>>
BIND基础配置详解
查看>>
火狐增加安全端口,每次用都得查,好麻烦,自己记录一下
查看>>
c# 多线程排队队列实现的源码
查看>>
LDA入门与Java实现
查看>>
19_css背景控制.html
查看>>
计算机网络测试和故障诊断的发展
查看>>
Delphi 与 DirectX 之 DelphiX(29): TDIB.AddMonoNoise();
查看>>
Windows Server 2008 FTP用户目录隔离模式
查看>>