Installing Rails on Mac OSX


I struggled a lot doing this on my mac. I prepared steps and notes while I was upgrading. here are the steps for mac osx. This works for Mac OSX 10.6+

============ Section 1 =================
Install and update Ruby 1.9 on MAC OSX Snow leopard 10.6.5

1. Install RVM
Installation instruction:

– In Treminal Run the following command:
bash < <( curl … all-latest )

– type in terminal: version=$(curl … sion.txt);

– type in terminal:
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src/ && curl -O … on}.tar.gz | tar zxf – && cd rvm-${version} && ./install

– The first time you install RVM, you must put the following line into your ~/.bash_profile at the very end, after all path loads etc:
(If you do not have .bash_profile then open terminal.
Start up Terminal
•    Type “cd ~/” to go to your home folder
•    Type “touch .bash_profile” to create your new file.
•    Edit .bash_profile with your favorite editor (or you can just type “open -e .bash_profile” to open it in TextEdit.
•    Type “. .bashrc” to reload .bashrc and update any functions you add.

– Update the .bash_profile and add this text.
[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm”  # This loads RVM into a shell session.

– Close the terminal and open a new terminal.
– Check if rvm is installed correctly by typing
type rvm | head -1
This should show result : “rvm is a function ”
– type : source ~/.rvm/scripts/rvm
– type: rvm notes

=========== Section 2: After you have done section 1 above ======

II Upgrade to ruby 1.9

– Make sure that you installed rvm
Instruction URL-

– type: rvm install 1.9.2

– Check which version of ruby is installed so far by typing “rvm list”.

– The new version of ruby will be active only until the terminal is open. To make ruby 1.9.2 as default version. Type: rvm  1.9.2 –default

– If we want to return to previous version of the system. Then type: rvm system –default

– Type: gem install rails

– INSTRUCTION URL: … ow-leopard

– First Stop the mysql server if it is running :
sudo /opt/local/share/mysql5/mysql/mysql.server stop

– Now download a fresh copy from this URL: … ow-leopard

– Next Install the mysql.pkg → Next install MySQLStartupItem.pkg -→ Install MySQL.prefPane

– The Mac OS X PKG of MySQL installs itself into
`/usr/local/mysql-VERSION’ and also installs a symbolic link,
`/usr/local/mysql’, that points to the new location. If a directory
named `/usr/local/mysql’ exists, it is renamed to
`/usr/local/mysql.bak’ first. Additionally, the installer creates the
grant tables in the `mysql’ database by executing `mysql_install_db’.

– Start the MySql server from the System Prefernce pane and make sure that it runs.

–  Go to /usr/local/mysql/bin and type: ./mysql, This should start start the MYSQL prompt and you can execute the SQl statements.

– Let us now secure the database by giving it a user id and password.
In the same package type: ./mysqladmin –u root password <your password>

Access Denied for local host after you have set root and password then you need to reset the password..

1. Stop the Server from preference pane.
2. From /usr/local/mysql/bin folder type the following the terminal:
  sudo ./mysqld_safe — –skip-grant-tables . This will start the server.
3. Type : ./mysql -u root mysql
4. type: UPDATE user SET Password=PASSWORD(‘admin’) where USER=’root’;  — This will set the password as admin.
5. Restart the server from prefernce pane.

Hope this helps. I used the exact same steps to upgrade to Rails 3.0.3 and ruby 1.9.2


14 dinesh19aug