Installing Ruby and Rails on Mac OS X using Locomotive

  • Install it by copying the Locomotive folder into a suitable directory such as /Applications/
  • Launch Locomotive
  • Create a new Ruby Application (Applications menu, Create New ). Give it a suitable name (e.g., test-2006-08-24 ), and save it anywhere you like (e.g., ~/Documents/ )).
  • Use Locomotive to start the Terminal application with the necessary environment (Applications menu, Open Terminal ... or keyboard shortcut cmd-T )
  • Download the Rails ODBC Adapter from Ruby Forge, and extract its contents to a directory of your choice (StuffIt Expander.app can do it in the GUI, or you can use command-line tar -xzvf on the tarball)
  • In the Terminal window opened by Locomotive (which will show evidence of sourcing an environment.bash file), navigate to the extracted Rails ODBC Adapter directory, and execute the command:

    rake install

  • When prompted about the installation location, answer i for install
  • The Rails ODBC Adapter should now be configured and ready for use with Locomotive. You should be able to use the help file provided to create a Rails Database application using the ODBC Adapter, by simply editing the standard database.yml file to point to a defined ODBC DSN:

    development: adapter: odbc dsn: virtla username: rails password: rails test: adapter: odbc dsn: virtla username: rails password: rails production: adapter: odbc dsn: virtla username: rails password: rails

Sample installation process


vpn187:~/Desktop hughwilliams$ tar xvpfz rails-odbc-1.0.tgz
rails-odbc-1.0/
rails-odbc-1.0/AUTHORS
rails-odbc-1.0/ChangeLog
rails-odbc-1.0/COPYING
rails-odbc-1.0/doc/
rails-odbc-1.0/doc/classes/
rails-odbc-1.0/doc/classes/ActiveRecord/
...
rails-odbc-1.0/install_odbc.rb
rails-odbc-1.0/lib/
rails-odbc-1.0/lib/connection_adapters/
rails-odbc-1.0/lib/connection_adapters/odbc_adapter.rb
rails-odbc-1.0/lib/vendor/
rails-odbc-1.0/lib/vendor/odbcext_informix.rb
rails-odbc-1.0/lib/vendor/odbcext_informix_col.rb
rails-odbc-1.0/lib/vendor/odbcext_ingres.rb
rails-odbc-1.0/lib/vendor/odbcext_microsoftsqlserver.rb
rails-odbc-1.0/lib/vendor/odbcext_microsoftsqlserver_col.rb
rails-odbc-1.0/lib/vendor/odbcext_mysql.rb
...
vpn187:~/Desktop hughwilliams$ cd rails-odbc-1.0

vpn187:~/Desktop/rails-odbc-1.0 hughwilliams$ ls
AUTHORS         ChangeLog       NEWS            Rakefile        install_odbc.rb support
COPYING         LICENSE         README          doc             lib             test

vpn187:~/Desktop/rails-odbc-1.0 hughwilliams$ rake install
(in /Users/hughwilliams/Desktop/rails-odbc-1.0)
/usr/local/bin/ruby install_odbc.rb

<< Installation script for Rails ODBC Adapter >>

Checking if Locomotive is installed

Target ActiveRecord directory for install:
[/Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record]
Enter c to change target ActiveRecord directory, q to quit, i to install
i

Copying ODBC Adapter files into the ActiveRecord tree.
------------------------------------------------------------
./vendor/odbcext_virtuoso.rb -> /Applications/Locomotive2/Bundles/...active_record.../odbcext_virtuoso.rb
chmod 0644 /Applications/Locomotive2/Bundles/...active_record.../odbcext_virtuoso.rb
...

------------------------------------------------------------

Checking RAILS_CONNECTION_ADAPTERS (active_record.rb) includes odbc.

Checking for Ruby ODBC Bridge.

odbc.bundle found in /Applications/Locomotive2/Bundles/rails112.locobundle/i386/lib/ruby/site_ruby/1.8/i686-darwin8.6.1

Done.
vpn187:~/Desktop/rails-odbc-1.0 hughwilliams$

If the Ruby ODBC Bridge is not installed in your Ruby installation then the following warning message will be displayed:


Checking for Ruby ODBC Bridge.

WARNING>> odbc.bundle* is not present under:
        /Applications/Locomotive2

The Ruby ODBC Bridge must be installed before the Rails ODBC Adapter can be  used.

Done.
ODBC-Rails and the ODBC-Rails website are Copyright (C) OpenLink Software 2006-2008