< Back

Upgrading to Snow Leopard for Ruby on Rails Developers

1

Posted by Lawrence Sinclair on 06 Nov 2009 at 12:48

 A Mac OS X Snow Leopard upgrade can go badly for Rails developers.

Norbauer provides some advise on fixing mySQL and other elements of the Ruby on Rails development environment that can break when upgrading to the  64-bit Snow Leopard environment. For a full description, see http://norbauer.com/notebooks/code/notes/snow-leopard-upgrading-for-rails-developers.

We have a large number of iMac OS X system on which we develop Ruby applications and were thankful this upgrade advise. Unfortunately, it did not alway address our problems. In those case, we actually found a fresh install was the most effective solution. Developers in the same situation may find the following directions for doing this helpful.

Duc and I tried to upgrade to Snow Leopard and to our surprise, it did not go very well. As a last resort, we had to make a fresh install of the OS. One shouldn't have to do this, but in case somebody needs to, here are the steps that I noted down:

 
--- Restart the machine with the the OS DVD, before you start the installation, click on Tools-> Disk Utility, Erase the hard drive. (If you don't do this step, you have have an upgrade system) Then go back to the installation process.
 
Here are some quick notes to set up development environment:
 
--- Install Xcode package from the DVD

--- Install 64 BIT Mac version of mysql package from mysql.com

--- Set sticky bit for /private/tmp/ (Prevent normal user to detele the /tmp/ folder which contains the mysql.sock)
chmod +t /tmp


--- Add path to mysql folder:
Put this into ~/.bash_profile
PATH=$PATH:/usr/local/mysql/bin

--- Check mysql socket location:
mysql_config --socket

--- Fix mysql.sock for PHP:
sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Test mysql.sock:
mysqladmin --socket=/path_to_socket_file/ version

--- Installing Ruby:

Xcode come with some basic gems and you cannot remove these gems. Of course you can upgrade to newest versions.

sudo gem update --system 
sudo gem install rails 
sudo gem update rake 
sudo gem update sqlite3-ruby

Because SL is a 64 bit, you have to install mysql gem for 64 bit architecture

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

This should get you ready for PHP / RoR / Mysql dev.
 
Cheers,
 

 

Tri

 

 

 

 

1 comment
  1. - Nov 10 2009

    Some additional notes that I missed: PHP already comes with SL but inactive by default. To enable it: Open /etc/apache2/httpd.conf. Uncomment this line: #LoadModule php5_module libexec/apache2/libphp5.so

Leave a comment