LoginSignup
2
3

More than 5 years have passed since last update.

rbenv, pyenvインストール覚え書き

Last updated at Posted at 2014-09-23

rubyやpythonに関して,複数のバージョンをインストールして使い分けたい場合がある.バージョンを切り替えるためのツールとしてrbenvやpyenvといったツールがある.
以下,これらをYosemiteにインストールした際の覚え書き.
なお,各種便利プラグインも一緒にインストールした.

インストール

rbenv

Homebrewを利用してインストール.

$ brew install rbenv ruby-build

~/.bash_profileに下記を追記

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

各種プラグインは下記をインストール.

$ brew install rbenv-bundler rbenv-binstubs rebenv-gem-rehash

pyenv

pyenvは頻繁にアップデートされるのでHomebrewを使わず,yyuu/pyenv, Common-build-problemsに従って手動でインストールした.$ pyenv updateで最新版にアップデートできる.

readline

本当に必要かはわからないけれど,Common-build-problemsに書いてあるのでreadlineをインストール.

$ brew install readline
$ brew link readline --force

~/.bash_profileに下記を追記

export LDFLAGS="-L/usr/local/opt/readline/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/readline/include $CPPFLAGS"

pyenv本体

pyenv installerを利用.各種プラグインもすべてインストールされる.

$ curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

~/.bash_profileに下記を追記

export PATH="$HOME/.pyenv/bin:$PATH"
if which pyenv > /dev/null; then
    eval "$(pyenv init -)"
    eval "$(pyenv virtualenv-init -)"
    export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include $CFLAGS"
fi

ruby, pythonのインストール

ruby, pythonのインストールは下記を実行するだけ.インストールしたバージョンへの切り替え等に関してはQiitaにたくさんある分かりやすい記事を参照のこと.

ruby

$ rbenv install 2.1.3

python

$ pyenv install 3.4.1

References

2
3
0

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
2
3