参考:
macを買って、今すぐherokuでruby1.9.3 + rails3.2しよう!
item2を入れる
どうやらターミナルらしいです。おすすめされたので入れてみます。以下URLにアクセス
http://code.google.com/p/iterm2/
ダウンロードタブを選択します。
currentって書いてる方をダウンロード
zip展開したら終わり
command line tools for xcodeを入れる または Xcodeを入れる
XcodeからCommand Line Tools for Xcodeに切り替えたらHDD使用容量が7GB減ったを参考にがしがし入れます。っていうか、Xcode入ってるんだけどねw
Xcodeのインストールはこちらを参考にどうぞ。
homebrewを入れる
参考サイトのコマンドを叩いたら、404エラーと言われたので、本家で確認。本家サイト:homebrew
先ほど入れたitem2を立ちあげて、以下のコマンドを叩きましょう。
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/go)"こんな感じ。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/go)" | |
==> This script will install: | |
/usr/local/bin/brew | |
/usr/local/Library/... | |
/usr/local/share/man/man1/brew.1 | |
==> The following directories will be made group writable: | |
/usr/local/. | |
==> The following directories will have their group set to admin: | |
/usr/local/. | |
Press enter to continue | |
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. | |
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. | |
==> Downloading and Installing Homebrew... | |
remote: Counting objects: 82693, done. | |
remote: Compressing objects: 100% (39044/39044), done. | |
remote: Total 82693 (delta 57065), reused 65858 (delta 42824) | |
Receiving objects: 100% (82693/82693), 11.54 MiB | 1.59 MiB/s, done. | |
Resolving deltas: 100% (57065/57065), done. | |
From https://github.com/mxcl/homebrew | |
* [new branch] master -> origin/master | |
HEAD is now at 05eceb8 tmux: Correct japanese sonant mark display | |
Warning: Install the "Command Line Tools for Xcode": http://connect.apple.com | |
==> Installation successful! | |
You should run `brew doctor' *before* you install anything. | |
Now type: brew help |
homebrewが何者かというと、MacのUNIXツールをインストールするためのパッケージ管理システムだそうです。便利くんってことですね。へー。
詳しくはこちらを参照に。
zshを入れる
好みって言われても使ったことないので、とりま入れるwwbashの拡張ならまだ書ける気がする。。
item2で以下のコマンドを実行する。
brewhome install zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install zsh | |
==> Installing zsh dependency: gdbm | |
==> Downloading http://ftpmirror.gnu.org/gdbm/gdbm-1.10.tar.gz | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/gdbm/1.10 --mandir=/usr/local/Cellar/ | |
==> make install | |
/usr/local/Cellar/gdbm/1.10: 10 files, 228K, built in 15 seconds | |
==> Installing zsh dependency: pcre | |
==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31. | |
######################################################################## 100.0% | |
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/pcre/8.31 --enable-utf8 --enable-unic | |
==> make test | |
==> make install | |
/usr/local/Cellar/pcre/8.31: 130 files, 3.2M, built in 50 seconds | |
==> Installing zsh | |
==> Downloading http://www.zsh.org/pub/zsh-5.0.0.tar.bz2 | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/zsh/5.0.0 --enable-fndir=/usr/local/C | |
==> make install | |
Warning: skip_clean :all is deprecated | |
Skip clean was commonly used to prevent brew from stripping binaries. | |
brew no longer strips binaries, if skip_clean is required to prevent | |
brew from removing empty directories, you should specify exact paths | |
in the formula. | |
==> Caveats | |
To use this build of Zsh as your login shell, add it to /etc/shells. | |
If you have administrator privileges, you must fix an Apple miss | |
configuration in Mac OS X 10.7 Lion by renaming /etc/zshenv to | |
/etc/zprofile, or Zsh will have the wrong PATH when executed | |
non-interactively by scripts. | |
Alternatively, install Zsh with /etc disabled: | |
brew install --disable-etcdir zsh | |
==> Summary | |
/usr/local/Cellar/zsh/5.0.0: 956 files, 8.5M, built in 105 seconds |
curl https://raw.github.com/gist/1970184/d7adf527117edd583de7b55141f8d7377a3b6cf6/.zshrc > ~/.zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl https://raw.github.com/gist/1970184/d7adf527117edd583de7b55141f8d7377a3b6cf6/.zshrc > ~/.zshrc | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 84 100 84 0 0 26 0 0:00:03 0:00:03 --:--:-- 35 |
中身を見る。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ~/.zshrc | |
export LANG=ja_JP.UTF-8 | |
# homebrewを優先 | |
export PATH=~/bin:/usr/local/bin:$PATH |
設定を反映するため、以下のコマンド実行
source ~/.zshrcシェルを変えるため、以下のコマンドも実行する
sudo sh -c "echo /usr/local/bin/zsh >> /etc/shells"
chsh -s /usr/local/bin/zsh
gitを入れる
gitをインストール。以下のコマンド実行
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install git | |
==> Downloading http://git-core.googlecode.com/files/git-1.7.12.tar.gz | |
######################################################################## 100.0% | |
==> make prefix=/usr/local/Cellar/git/1.7.12 CC=cc CFLAGS= LDFLAGS= install | |
==> make CC=cc CFLAGS= LDFLAGS= | |
==> make clean | |
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.7.12.tar.gz | |
######################################################################## 100.0% | |
==> Downloading http://git-core.googlecode.com/files/git-htmldocs-1.7.12.tar.gz | |
######################################################################## 100.0% | |
==> Caveats | |
The OS X keychain credential helper has been installed to: | |
/usr/local/bin/git-credential-osxkeychain | |
The 'contrib' directory has been installed to: | |
/usr/local/share/git-core/contrib | |
==> Caveats | |
Bash completion has been installed to: | |
/usr/local/etc/bash_completion.d | |
==> Summary | |
/usr/local/Cellar/git/1.7.12: 1235 files, 24M, built in 42 seconds |
config設定をする。gitのアカウントを持っていたら、その情報と連携させた方がいいんだろうな。。
git config --global user.name "your name"
git config --global user.email "youraddress@example.com"
automakeを入れる
簡単な記述でmakeをしてくれるやつらしい。詳しくはこちらbrewhome install automake実行結果はこんな感じ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install automake | |
==> Installing automake dependency: autoconf | |
==> Downloading http://ftpmirror.gnu.org/autoconf/autoconf-2.69.tar.gz | |
######################################################################## 100.0% | |
==> Patching | |
patching file bin/autoreconf.in | |
==> ./configure --prefix=/usr/local/Cellar/autoconf/2.69 | |
==> make install | |
/usr/local/Cellar/autoconf/2.69: 67 files, 1.9M, built in 10 seconds | |
==> Installing automake | |
==> Downloading http://ftpmirror.gnu.org/automake/automake-1.12.3.tar.gz | |
######################################################################## 100.0% | |
==> ./configure --prefix=/usr/local/Cellar/automake/1.12.3 | |
==> make install | |
/usr/local/Cellar/automake/1.12.3: 129 files, 2.0M, built in 8 seconds |
rvmを入れる
複数のRubyを管理するツール。bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)パスを通すようにzshrcのファイルを開く
vim ~/.zshrc開いたら、以下の記述を追記する。
# rvm
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
ruby1.9.3を入れる
以下のコマンドを実行する。rvm install 1.9.3 --with-gcc=clangするとこんな感じで怒られたorz
You requested building with 'clang' but it is not in your path.どうやら、Xcodeの中からgccがなくなったのが原因っぽい。(参考:rvmによるrubyのアップデートでハマる)
Xcodeからインストールできるみたいなので、commandLineをインストールする。
参考:Mac OS X Lionにしたらgccがなくてnode.jsがコンパイルできなくなった件
インストールが終わったら、gccが入ったことを確認
gcc -vこんなん出てればOK
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~28/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
ようやく戻って、もう一度Rubyをインストール
rvm install 1.9.3 --with-gcc=clangRubyのバージョンを指定します。
rvm use 1.9.3
Rubyのバージョンを確認
ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
次はHerokuの環境構築しまーす。
今日はここまで。
0 件のコメント:
コメントを投稿