Project development from Ruby into a JRuby, so at their own Mac to install on JRuby and Rails. Process more or less the same, but there is some place a little noteworthy.

My system is Mac OS X 10.5.5, the installation of JRuby 1.1.6, the development of the use of Sqlite3.



0. Ready

Already installed JDK 5 or above

Ant has been installed

(In fact, Mac had recently been installed on it)

1. Install JRuby

1.1 install JRuby

Download jruby-bin-1.1.6.tar.gz , Unzip it put on the jruby-1.1.6 directory to the appropriate place, such as / usr / lib / directory.

And to add to PATH in JRuby:

Modify ~ /. Bash_profile file, the last two lines of increased RUBY_HOME, and modify PATH as follows:
export
RUBY_HOME = / usr/lib/jruby-1.1.6
export PATH
= $ RUBY_HOME / bin: / Users/user/.gem/ruby/1.8/bin: $ PATH

And refresh profile documents:

source ~ /. bash_profile

2. To install Rails
2.1 Install rails

jgem install rails - no-rdoc - no-ri

Or: jruby-S gem install rails - no-rdoc - no-ri (the same below)



2.2 install rake

jgem install rake



2.3 install activerecord-jdbc

Use sqlite3, so use:

jgem install activerecord-jdbcsqlite3-adapter - no-rdoc - no-ri

If you use mysql, then use:

jgem install activerecord-jdbcmysql-adapter - no-rdoc - no-ri



Note: The above approach is relatively simple to install. If you separately install activerecord-jdbc-adapter and the sqlite3-ruby, have the following error:

Building native extensions. This could take a while ...
/ usr/lib/jruby-1.1.6/lib/ruby/1.8/mkmf.rb: 7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError)
from
/ usr/lib/jruby-1.1.6/lib/ruby/1.8/mkmf.rb: 1: in `require '
from
extconf.rb: 1
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.




2.3 install openssl

Above has been installed there is an error:

JRuby limited openssl loaded. Gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL

Such openssl installed you can click:

jruby-S gem install jruby-openssl



Note modify database.yml when used in the adapter:



development:
adapter: jdbcsqlite3
database: db/development.sqlite3
timeout: 5000

Here you can start using JRuby on Rails has.

Reference article:

Get JRuby onto the Rails on Mac OS X (Note: this article has some mistakes, followed by comments to the correct)

TOTD # 37: SQLite3 with Ruby-on-Rails on GlassFish Gem