参考
http://namakesugi.blog42.fc2.com/blog-entry-141.html
http://frtts.hatenablog.com/entry/20120308/1331200027
http://d.hatena.ne.jp/NowTom/20110728/1311834182
http://d.hatena.ne.jp/gan2/20120530/1338387974
XCodeをインストール
AppStoreより4.3.3をインストールする。
XCodeを起動し、[Cmd] + [,]でPreferencesを開く。
Downloadsタブを選択し、Command Line ToolsのInstallボタンを押してインストール。
ついでに、iOS 5.0 Simulatorをインストール。
Homebrewをインストール
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
Git等をインストール
brew install git brew install wget
rvmをインストール
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
- .bashrc
export CC=gcc-4.2
以下のコマンドを実行
curl -L https://get.rvm.io | bash -s stable
Rubyインストール
brew install libksba
パッケージ一式をインストール
rvm pkg install zlib rvm pkg install readline rvm pkg install iconv rvm pkg install openssl rvm pkg install autoconf rvm pkg install libxml2 rvm pkg install libxslt
必要なRubyをインストール
rvm install 1.9.2 rvm install 1.9.3
gemset作成、デフォルトのRuby変更
rvm use 1.9.3 rvm gemset create rails rvm use 1.9.3@rails --default
Git設定
git config --global user.email [your git email] git config --global user.name [your git name] git config --global --add core.excludesfile ~/.gitignore
PostgreSQL
インストール
brew install postgresql
インストール後のメッセージ
# Build Notes If builds of PostgreSQL 9 are failing and you have version 8.x installed, you may need to remove the previous version first. See: https://github.com/mxcl/homebrew/issues/issue/2510 To build plpython against a specific Python, set PYTHON prior to brewing: PYTHON=/usr/local/bin/python brew install postgresql See: http://www.postgresql.org/docs/9.1/static/install-procedure.html # Create/Upgrade a Database If this is your first install, create a database with: initdb /usr/local/var/postgres To migrate existing data from a previous major version (pre-9.1) of PostgreSQL, see: http://www.postgresql.org/docs/9.1/static/upgrading.html # Start/Stop PostgreSQL If this is your first install, automatically load on login with: mkdir -p ~/Library/LaunchAgents cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist If this is an upgrade and you already have the homebrew.mxcl.postgresql.plist loaded: launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist cp /usr/local/Cellar/postgresql/9.1.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist Or start manually with: pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start And stop with: pg_ctl -D /usr/local/var/postgres stop -s -m fast # Loading Extensions By default, Homebrew builds all available Contrib extensions. To see a list of all available extensions, from the psql command line, run: SELECT * FROM pg_available_extensions; To load any of the extension names, navigate to the desired database and run: CREATE EXTENSION [extension name]; For instance, to load the tablefunc extension in the current database, run: CREATE EXTENSION tablefunc; For more information on the CREATE EXTENSION command, see: http://www.postgresql.org/docs/9.1/static/sql-createextension.html For more information on extensions, see: http://www.postgresql.org/docs/9.1/static/contrib.html # Other Some machines may require provisioning of shared memory: http://www.postgresql.org/docs/current/static/kernel-resources.html#SYSVIPC To install postgresql (and ossp-uuid) in 32-bit mode: brew install postgresql --32-bit If you want to install the postgres gem, including ARCHFLAGS is recommended: env ARCHFLAGS="-arch x86_64" gem install pg To install gems without sudo, see the Homebrew wiki.
DB作成
initdb /usr/local/var/postgres
成功後のメッセージ
Success. You can now start the database server using: postgres -D /usr/local/var/postgres or pg_ctl -D /usr/local/var/postgres -l logfile start
DBを手動でフォアグラウンドで動かす
$ postgres -D /usr/local/var/postgres
止めるには^Cを入力する。
DBを手動でバッググラウンドで動かす
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
バッググラウンドで動かしているDBを手動で止める
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast