Mac OS X に Rails 開発環境を構築する

Mac Book Air (Mac OS X Lion) で Rails 開発環境を構築しました。

AppStore から XCode をインストールします。

Rails をインストールします。
$ gem install rails 

Homebrew をインストールします。
$ ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"

MySQL をインストールします。
$ brew install mysql
$ cd /usr/local
mysql_install_db --verbose -user='whoami' --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h xxxx.local password 'new-password' 

Alternatively you can run:
./bin/mysql_secure_installation

which will also give you the option of removing the test databases and anonymous user created by default.
This is strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl

Please report any problems with the ./bin/mysqlbug script!

$ sudo cp Cellar/mysql/5.5.19/support-files/mysql.server bin/my.cnf

mysql.server start

.. SUCCESS! 

動作確認します。

$ rails ~/Code/Ruby/testhoge

$ cd ~/Code/Ruby/testhoge

$ rails server

ブラウザで http://localhost:3000/ にアクセスして、Welcome Aboard が表示されることを確認して完了。