Mac(OSX) Jruby and Rails 2.2

Not Sure why but I wanted to try JRuby and Rails(2.2) new threads…

These are the steps I used to get a application on my mac running with Rails 2.2 and JRuby 1.1.3(I used ports to install JRuby thats why 1.1.3).

Here are the steps:

– First Install JRuby .. # sudo port install jruby

– Fix an annoying warning .. # sudo jruby -S gem install jruby-openssl

– Install rails .. # sudo jruby -S gem install rails

– Install the database connector .. # sudo jruby -S gem install activerecord-jdbc-adapter

– Upgrade the gem environment .. # sudo jruby -S gem update

– Install latest RubyGems (Rails 2.2 Needs 1.3.1 or higher.. ) .. # sudo jruby -S gem install rubygems-update

– Now you have to force install the update .. # sudo jruby -S update_rubygems

– Install Rails 2.2.1 .. # jruby -S gem install rails -s

# jruby -S rails myapp
# cd myapp
# vi config/database.yml

adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost/testapp_development
username: root

# vi config/environment.rb
Add this code:

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), ‘boot’)
if RUBY_PLATFORM =~ /java/
require ‘rubygems’

# jruby script/server
=> Booting WEBrick…
=> Rails 2.2.1 application started on
=> Ctrl-C to shutdown server; call with –help for options
[2008-11-17 16:40:34] INFO WEBrick 1.3.1
[2008-11-17 16:40:34] INFO ruby 1.8.6 (2008-11-17) [java]
[2008-11-17 16:40:34] INFO WEBrick::HTTPServer#start: pid=13484 port=4000



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: