Mac OSX Lion 開発環境 ver. rails3.2
[参考]Ruby on Rails 3.2 を Mac OS X にインストールする手順をかなり丁寧に説明してみました
rbenv と ruby-build のインストール
$ brew install rbenv ==> Downloading https://github.com/sstephenson/rbenv/tarball/v0.3.0 ######################################################################## 100.0% ==> Caveats To enable shims and autocompletion, add rbenv init to your profile: if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi ==> Summary /usr/local/Cellar/rbenv/0.3.0: 32 files, 160K, built in 3 seconds $ which rbenv /usr/local/bin/rbenv $ brew install ruby-build ==> Downloading https://github.com/sstephenson/ruby-build/tarball/v20120524 ######################################################################## 100.0% ==> ./install.sh /usr/local/Cellar/ruby-build/20120524: 45 files, 196K, built in 3 seconds $ which ruby-build /usr/local/bin/ruby-build $ source ~/.zshrc
$ brew install readline ==> Downloading http://ftpmirror.gnu.org/readline/readline-6.2.tar.gz ######################################################################## 100.0% ==> Downloading patches ######################################################################## 100.0% ######################################################################## 100.0% ==> Patching patching file vi_mode.c patching file callback.c patching file support/shobj-conf patching file patchlevel ==> ./configure --prefix=/usr/local/Cellar/readline/6.2.2 --mandir=/usr/local/Cellar/readline/6.2.2/share/man --infodir=/usr/local/Cellar/readline/6.2.2/share/info --enable-multibyte ==> make install ==> Caveats This formula is keg-only, so it was not symlinked into /usr/local. OS X provides the BSD libedit library, which shadows libreadline. In order to prevent conflicts when programs look for libreadline we are defaulting this GNU Readline installation to keg-only. Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add its lib & include paths to your build variables: LDFLAGS -L/usr/local/Cellar/readline/6.2.2/lib CPPFLAGS -I/usr/local/Cellar/readline/6.2.2/include ==> Summary /usr/local/Cellar/readline/6.2.2: 30 files, 1.5M, built in 17 seconds $ brew link readline Linking /usr/local/Cellar/readline/6.2.2... 12 symlinks created
# CONFIGURE_OPTS="--with-readline-dir=/usr/local" rbenv install 1.9.3-p194 Downloading http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz... Installing yaml-0.1.4... Installed yaml-0.1.4 to /Users/aokishinichi/.rbenv/versions/1.9.3-p194 Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz... Installing ruby-1.9.3-p194... Installed ruby-1.9.3-p194 to /Users/aokishinichi/.rbenv/versions/1.9.3-p194 $ rbenv rehash $ rbenv global 1.9.3-p194 $ rbenv version 1.9.3-p194 (set by /Users/aokishinichi/.rbenv/version) $ ruby -v ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
あれ?1.9.3になってない。
再度、sourceしたらうまくいった。
$ source ~/.zshrc $ ruby -v ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.2]
$ rbenv exec gem install rails --version="~> 3.2.5" $ rbenv rehash $ rails -v Rails is not currently installed on this system. To get the latest version, simply type:
$ source ~/.zshrc $ rails -v Rails 3.2.6
できた。
eval "$(rbenv init -)"
これに意味があるのかも。
しかし、.gemrcを書き忘れてた。インストール後に書いたけど、どうなんだろ?あとでトラブルにならないかドキドキ。