rbenv

since 2022-11-19

さすがに chruby が古すぎるので。。。

以下 WSL2 Ubuntu 18.04.1 LTS

https://github.com/rbenv/rbenv#basic-git-checkout

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bash_profile
$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

例えば ruby 2.3.0 を使ってみたい

$ rbenv install 2.3.0

$ rbenv versions
* system
  2.3.0

その ruby を使いたいソースコートに移動して

$ rbenv local 2.3.0
$ rbenv exec gem update --system
$ rbenv exec gem install bundler
$ rbenv exec bundle
$ rbenv exec bundle exec 以下略
# 利用できる安定版を確認
$ rbenv install -l

# プレビュー版を含めて、利用できるものを確認
$ rbenv install -L

3.1.2 を入れて、グローバルに有効化する

$ rbenv install 3.1.2
To follow progress, use 'tail -f /tmp/ruby-build.20221224103902.17444.log' or pass --verbose
Downloading ruby-3.1.2.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.2.tar.gz
Installing ruby-3.1.2...
Installed ruby-3.1.2 to /home/nishimotz/.rbenv/versions/3.1.2


NOTE: to activate this Ruby version as the new default, run: rbenv global 3.1.2
$ rbenv global 3.1.2

$ which irb
/home/nishimotz/.rbenv/shims/irb

$ irb
irb(main):001:0> RUBY_VERSION
=> "3.1.2"
rbenv.txt · 最終更新: 2022/12/24 10:43 by Takuya Nishimoto
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0