Pages

Wednesday, January 19, 2011

Installing Ruby on Rails on Mac OS X

Installing Ruby on Rails on Mac OS X

Leopard (10.5)

Ruby (1.8.6), Ruby Gems (1.0.1) and Rails (1.2.3) ship with the latest version of OS X (10.5, Leopard).
You may want to upgrade Rails to take advantage of the latest and greatest improvements. The version of Rails that ships with OS X is rather old (in Rails development terms).
You should also make sure you have xCode tools installed from your OSX disk, since you will likely run into the need to compile applications during your run with Rails.
To accomplish this, you should first update Ruby Gems.
$ sudo gem install rubygems-update
$ sudo update_rubygems
Then a simple re-installation of Rails will get you to the latest release.
$ sudo gem update
$ sudo gem update --system
$ sudo gem install rails

Tiger (10.4) and Panther (10.3)

RubyOSX v1.2 is a one click installer that will install Ruby 1.8.6, RubyGems 0.9.4, Mongrel 1.0.1 and SQLite 3.4.0. for Tiger (10.4) and Panther (10.3). It however, will not install Rails. After installing RubyOSX you should first update Ruby Gems.
$ sudo gem install rubygems-update
$ sudo update_rubygems
Then a simple installation of Rails will get you to the latest release.
$ sudo gem install rails

Alternative Method for Leopard (10.5) and Tiger (10.4)

Bitnami RubyStack

Using Bitnami RubyStack with FiveRuns TuneUp BitNami RubyStack (1.4-beta-1) ships with the following:
  1. Ruby 1.8.6 and 1.9.0 developer branch
  2. RubyGems 1.2.0
  3. Rails 2.1.1
  4. ImageMagick 6.3.6
  5. Subversion 1.4.6
  6. SQLite 3.5.1
  7. MySQL 5.0.51a
  8. Apache 2.2.8
  9. Mongrel Web Server 1.1.5
  10. Capistrano 2.5
  11. PHP 5.2.6
  12. phpMyAdmin 2.11.2.2
  13. Git 1.5.5
  14. Nginx 0.6.30
Note: Bitnami RubyStack will not support Passenger, as it does not support Windows platform
 
If you select Developer version then you will get a choice of installing PhpMyAdmin. In developer version Apache isn't preconfigured 
If you select Production version then Bitnami will install Mongrel Cluster, with Apache preconfigured to act as a load balancer for Mongrel  
Enter MySql 'root' password, port for Apache webserver, OpenSSL and Mysql     
Bitnami will install 3 databases, Developer, Production and Test databases. Here you should add a user that will have rights to these databases.  
All Done.

Macports

You may wish to use MacPorts to install Rails if you are using Leopard (10.5), Tiger (10.4) or Panther (10.3).
First you should Download the latest version of Xcode Tools if you have the currently shipping release of Mac OS X. Without Xcode Macports will not work
Download and install the appropriate version of Macports from MacPorts install page. MacPorts can be installed with a .dmg image using a familiar step-by-step installer. This will take quite some time to install, so be patient, it downloads the entire ports repository during “Finishing Installation” phase.

Command Line option

Open the Terminal application and type the following command, followed by the return key. It will most likely prompt you to enter your password.
$ sudo port install rb-rails
or type in the complete path like so
$ sudo /opt/local/bin/port install rb-rails
This will install the required rails dependencies like Ruby, RubyGems, Rake and SQLite. This will also take a very long time, depending on your computer speed, since everything is compiled from source.
That's it! Now you're ready to create new Rails applications.
If you want you can also install Mongrel, Capistrano, Mysql and Rspec using the following command.
$ sudo port install rb-capistrano rb-mongrel_cluster rb-mysql rb-rspec-rails

GUI option

Install Porticus, which is a gui for Macports Package Manager. Search for rails in the search bar in the top right corner 
Select rb-rails and click the install icon on the top right corner. It will install all the required dependencies. All done, rails is now installed. If you want you can also install rb-mongrel_cluster. Although its recommended to use Passenger with apache.

( http://wiki.rubyonrails.org/getting-started/installation/mac)

No comments:

Post a Comment