Installing Ruby on Rails on Snow Leopard

I’m trying to use Ruby and Rails and getting very disheartened after a
day of failure with a variety of errors. I’ve tried various approaches
from the suggestions on this and other forums, so far all without
success. These include three separate ways of doing the installation.

In all cases, I’ve simply done the steps in the getting started guide:
rails firstgo -d mysql
cd firstgo
rake db:create

(1) Using the built-in ruby that came with the Mac Xcode package (I
believe) in /usr/bin

This results in the message:

Couldn’t create database for {“reconnect”=>false, “encoding”=>“utf8”,
“username”=>“root”, “adapter”=>“mysql”,
“database”=>“firstgo_development”, “pool”=>5,
“password”=>“mypassword”, “socket”=>“/tmp/mysql.sock”}, charset: utf8,
collation: utf8_unicode_ci (if you set the charset manually, make sure
you have a matching collation)

None of the following facts mentioned in forums have helped:

  • I do have 64 bit MySQL loaded.

  • It is the correct password.

  • I have tried the password both with and without quotes

  • It is the correct socket.

  • I have tried this both with the Mysql driver as it was originally
    loaded, and with the command:
    sudo env ARCHFLAGS=“-arch x86_64” gem install mysql – --with-mysql-
    config=/usr/local/mysql/bin/mysql_config
    (which is pointing at the correct mysql config.)

  1. Compiling Ruby from source into /usr/local/bin
    =====================================
    I follow the instructions in
    Dan Benjamin
    to compile Ruby 1.8.7 from source. I’ve tried it both with Rubygems
    1.8.5 (the current one) and 1.8.3 (as described in the original post).
    Here, the process doesn’t get that far, giving the following messages:

rake aborted!
no such file to load – iconv
/Users/david/rubicon/firstgo/Rakefile:10
(See full trace by running task with --trace)

  1. Compiling Ruby from macports into /opt/local/bin
    ======================================
    I started with sudo port install ruby19, and then followed the various
    instructions to update rubygems, bring in the MySQL driver, etc.

In this case, the system told me that the built-in mysql driver had
been removed, and that I should run sudo gem install mysql.

I did this, and verified that gem could see mysql in the list. But
this didn’t make any difference to the error message.

AAAAAAARGH!

About the only thing I haven’t done is to uninstall and reinstall
MySQL. I’m really reluctant to do this, since it’s a perfectly good 64-
bit version, and I daren’t risk the other things on my system that use
it - this is the main system I use for development of a load of other
stuff.

A full and long day’s work later with no results, I’m pretty
distressed.

Does anyone have any ideas?

Hi,

you can try using VirtualRails : http://www.virtualrails.org

it’s a free virtual linux-based Ruby on Rails development environment,
all fully configured.
It runs under virtualbox, and takes 5 mins to install.
nonetheless you OSX won’t suffer from the “rails-conf process” :slight_smile:

Jerome F. wrote:

Hi,

you can try using VirtualRails : http://www.virtualrails. org

But you shouldn’t have to. Apple’s Ruby plus a working MySQL
installation should be fine; search the list archives for ideas on why
your setup isn’t working. Better yet, switch to PostgreSQL, which is a
much better database.

Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

On Jul 23, 4:25 am, xgretsch [email protected] wrote:

I’m trying to use Ruby and Rails and getting very disheartened after a
day of failure with a variety of errors. I’ve tried various approaches
from the suggestions on this and other forums, so far all without
success. These include three separate ways of doing the installation.

Sounds like you’ve done everything right, but let me throw out a
stupid question: any chance your mysql server isn’t actually running?
When I logoff/reboot, I always forget to restart the mysql service and
I get weird client errors.

Jeff
purpleworkshops.com

Also if mysql is running, log on to mysql in the terminal using the user
and
password in your conf and make sure you can get in –

mysql -u [user_name] -p

Thanks (and the stupid questions are worth asking!) but mysql is
definitely OK and running (by the way, it launches at startup - Jeff,
I can point out how if you’re interested).

I kind of wonder whether there’s an incompatibility in the mysql
password mechanism between “old passwords” and “new passwords” - the
difference being in the “identified by ‘mypassword’|” and the
“identified by password(‘mypassword’)” constructs. But I can’t
actually tell what the ruby mysql driver is trying to do…

I’ve given up on the mysql driver for now and am testing using
sqlite3. Eventually, I may have to revisit this one.

But it’s not pretty…