LoginSignup
36

More than 5 years have passed since last update.

Ruby・Nodeを使うなら、rbenv・ndenvが便利

Posted at

Ruby(Node)を使うなら、バージョン管理しやすいようrbenv(ndenv)を使うのが便利。
(rbenvもndenvも使い方はほぼ一緒)

Nodeバージョン管理(ndenv + node-build)

1. ndenvインストール

git clone https://github.com/riywo/ndenv ~/.ndenv
echo 'export PATH="$HOME/.ndenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(ndenv init -)"' >> ~/.bash_profile
exec $SHELL -l
ndenv -v

最後のコマンドでバージョン出れば、ndenvインストール成功!

2. node-buildインストール

git clone https://github.com/riywo/node-build.git ~/.ndenv/plugins/node-build

3. インストールできるバージョン一覧

ndenv install -l

4. Nodeインストール

ndenv install v0.11.13 ←バージョンは適宜好きなものを!
ndenv rehash        ←再構築(インストール後のおまじない)
ndenv global v0.11.13  ←デフォルトのバージョンに設定
node -v

最後のコマンドでバージョン出れば、Nodeインストール成功!

5. インストール済みのバージョン一覧

ndenv versions

※参考url
http://blog.tavi-travelog.net/2013/06/29/node-install-macports-to-ndenv/

Rubyバージョン管理(rbenv + ruby-build)

1,2. rbenv、ruby-buildインストール

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

source ~/.bash_profile
rbenv -v

3. インストールできるバージョン一覧

rbenv install --list

4. Rubyインストール

rbenv install 2.0.0-p481
rbenv rehash
rbenv global 2.0.0-p481
ruby -v

5. インストール済みのバージョン一覧

rbenv versions

※参考url
http://dev.classmethod.jp/server-side/language/build-ruby-environment-by-rbenv/

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
36