Cannot rake migrate on OS X After New Install, Tons of Debug


#1

I’m getting ready to go to the Rails Studio in Pasadena next week. As
part of the prep for that event, I was instructed by the Pragmatic
guys to download and install a new Rails 1.0/Ruby 1.8.4 configuration
to my OS X 10.4.4 box. I did that three or four days ago. Ever since
then, I cannot run a rake migrate command successfully anywhere in my
Rails world. (Mind you, I’m not sure I ever could. I never had
occasion to try before.)

Dave T. and Mike C. have been extremely helpful trying to get
me over this hump but they’re teaching now and I’m getting concerned
that I may just not be able to get Rails working correctly on my
system without some drastic surgery and the time to prep for the
workshop is getting scarce.

They supply an install-rails.sh script that essentially automates the
HiveMinds installation process. I ran that and everything seemed to
go just fine but I can’t do a rake migrate. It reports back the
directory itr’s in and then just hangs. I have to ctrl-C out of it.
So after a lot of debugging and looking and trying different things
and dorking with the path, all to no avail, I went to the HiveMinds
site and carefully followed their step-by-step instructions,
suspecting perhaps an error in the shell script. No such luck. The
install went fine, but at the end of it all I still can’t do a rake
migrate.

One person on the rails IRC channel suggested I rebuild my Ruby
database bindings but nobody there was able to tell me how and I
can’t figure it out.

Another person on that channel suggested I try running straight Ruby
database commands to see if I can connect to and use the database
from a Ruby script without Rails in the loop. He said I should look
in ruby-mysql. No such directory or file is to be found and the Ruby
docs and book don’t tell me how to connect to the MySQL database.

Can ANYONE help? Heck, I’d be willing to pay someone a consulting fee
to help me get this working and teach me what I evidently did wrong
without knowing it. OF the 50 or so folks going to Pasadena, I appear
to be the only one having problems. At least nobody else has reported
any to that list yet.

Thanks.

Dan


#2

I have been battling this problem (described in the subject line) for
several days now. It has not yielded. On the small mail list of
people going to Rails Studio – including Dave T. and Mike C.
– nobody has been able to help. The fact that I didn’t get a single
response here on this much larger list leads me to believe that the
problem is if not intractable at least weird and difficult.

I can’t believe Rails requires this level of system-level
sophistication to install. I know my situation was complicated by the
fact that I had two previous Rails installs – one from a single-
click install script and one from Locomotive – and ended up with two
copies of MySQL (though only the correct one seems to be running at
all). But this has really started me wondering if Rails is ready for
me to use yet. I’ve gone through the tutorials using 0.14.3 on a
Dreamhost server with success but if I can’t get a local install
running after all the time and effort that’s been put into it, I
wonder about the mismatch between what I know how to do and what is
apparently required to make this work.

It’s quite frustrating. Everybody says this shouldn’t be hard but it
sure has been!

Dan


#3

I’m running on OS X 10.4.4 and can do rake migrate fine. What are the
specific errors you are getting?

Do a rake -t migrate and post the output. It’s hard to help without
specifics. Hope this helps.

What’s wrong with Locomotive? It doesn’t work also?

– G.


#4

Let somebody with a working version make a disk image of that os.
You make a partition and install that image.
Figure out after or at the show whats wrong.

Done.


#5

I had a couple of problems before with MySQL not working. Maybe he
should also install Postgresql and switch his database.yml to see if
that works. Start with the pure ruby bindings first, get them to
work, and only then move to native bindings.

I use the darwinports ruby. Have locomotive as well, but I don’t use
it that often, last time I did was between rubygems upgrades that
broke my unit tests (actionwebservices was complaining about frozen
objects being modified after I upgraded from ruby 1.8.2 to ruby
1.8.4 …).

Since you are new, would advise to use Locomotive for now and get
help when everyone is in the same room. You don’t have too long to
wait. As for me, I live in Accra, Ghana with no one around to help,
so I have gotten used to helping myself with the help of Google, log
files, lots of patience … Rails is worth it, and these experiences
teach you a lot more about it.

– G.


#6

One more thing. I realized that when a require in Rails fails,
somethings just don’t get reported and it dies silently. My bet is
that a require somewhere is failing … because of your peculiar
setup, maybe something old is somewhere and in the way of something
new. You may want to use irb to test little bits at a time until you
figure out the culprit …

– G.


#7

Guido…

On Jan 22, 2006, at 9:24 AM, Guido S. wrote:

I’m running on OS X 10.4.4 and can do rake migrate fine. What are
the specific errors you are getting?

No specific errors. rake migrate simply hangs until I control-C out
of it, then I get “rake aborted”.

Do a rake -t migrate and post the output. It’s hard to help without
specifics. Hope this helps.

OK, here’s that output.

** Invoke migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
development database is not configured
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/
connection_adapters/abstract/connection_specification.rb:73:in
establish_connection' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:66:inestablish_connection’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:169:in
initialize_database' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:83:inprocess’
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:in send' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:inrun’
./config/…/config/environment.rb:10
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in require__' /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/
dependencies.rb:214:in require' /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/tasks/misc.rake:9 /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/tasks/misc.rake:8:incall’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:ineach’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:202:in execute' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:180:ininvoke’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:179:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:179:ineach’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:827:in send' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:827:ineach’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:179:in invoke' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:in each' /usr/lib/ruby/gems/1.8/gems/rake-0.6.2/lib/rake.rb:1454:inrun’
/usr/lib/ruby/gems/1.8/gems/rake-0.6.2/bin/rake:7
/usr/bin/rake:18:in `load’
/usr/bin/rake:18

What’s wrong with Locomotive? It doesn’t work also?

The Pragmatic guys said that some attendees at their Studios have
reported some problems with Locomotive so they didn’t recommend it. I
am nonetheless beginning to experiment with using Locomotive with
SQLite since there seems to be agreement among those who know more
than I do (which constitutes the entire known universe of Rails
developers!) that the problem is somehow database related.

I have used SQLite in other projects from other languages so I’m at
least basically familiar with its operation. When I type:

sqlite3 db/allaboard_development.db

I do indeed get a database called “allaboard_development.db” in my
app’s db directory. So far, so good. I type

.databases

at the sqlite prompt and, sure enough, there’s my database.

So I type

rake migrate

And after a few moments I see:

rake aborted!
development database is not configured

I thought the purpose of rake was to configure and populate the
database so now I’m really at a loss. I have not been given the
database structure – and I understood I shouldn’t need it since this
is the first time running rake on this database. The output of rake -
t migrate is identical to that above with the exception that the path
is the directory for Locomotive’s rails-1.0.0-max.bundle.

So I remain bewildered. Hopefully I can resolve this soon.

I appreciate your help.

Dan


#8

On Jan 23, 2006, at 5:44 PM, Dan S. wrote:

Do a rake -t migrate and post the output. It’s hard to help
without specifics. Hope this helps.

OK, here’s that output.

** Invoke migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
development database is not configured

Right here, there’s a problem! You need to at least edit config/
database.yml to have the correct database adapter, database name,
user and password. You will need to at least create the database so
you have an empty database. Once you have an empty database then the
migrations may be able to work, unless you have something really bad
going on. Check the instructions that were sent to you.

You sound like you would be aided by purchasing the Agile Web
Development with Rails and the Programming Ruby books. And maybe
another Ruby book as well. The rails book is very good and walks you
through some of these things.

If you are using Locomotive, a point to look out for is to open the
terminal from the Locomotive file menu, rather than from the dock,
since it sets up the environment properly for Locomotive that way.

– G.


#9

Well, I finally got things working with Locomotive using SQLite. Now
that we’ve gone through a process that stretched over most of a week,
I think what we’ve discovered is that the culprit was the presence of
tabs rather than multi-space indents in the database.yml file. This
in turn was caused by the default setting in TextMate at some point.
At least that’s our operating theory.

For now, I’m going to consider my setup stable and finish prep for
the studio. Maybe while i’m there, I’ll find someone who can help me
confirm the source of this problem and get Rails working outside
Locomotive once and for all. Not that I don’t like Locomotive; I do.
It’s just that several people told me I could encounter “issues” in
working with Locomotive that don’t come up with stanards Rail
installations.

Thanks for all the helpful suggestions, folks.

Dan


#10

Guido…

On Jan 23, 2006, at 12:08 PM, Guido S. wrote:

You sound like you would be aided by purchasing the Agile Web
Development with Rails and the Programming Ruby books. And maybe
another Ruby book as well. The rails book is very good and walks
you through some of these things.

I have bought both of the titles you mention and worked my way
through most of the Agile book already. But that was before I was
instructed to upgrade my system to Rails 1.0. But, as you know from
our other discussion, everything is fine now. I think it was a
problem with tabs instead of spaces in the .yml file.

If you are using Locomotive, a point to look out for is to open the
terminal from the Locomotive file menu, rather than from the dock,
since it sets up the environment properly for Locomotive that way.

Thanks. I learned that the hard way, too!

Dan


#11

On Jan 23, 2006, at 10:44 AM, Dan S. wrote:

The Pragmatic guys said that some attendees at their Studios have
reported some problems with Locomotive so they didn’t recommend it.
I am nonetheless beginning to experiment with using Locomotive with
SQLite since there seems to be agreement among those who know more
than I do (which constitutes the entire known universe of Rails
developers!) that the problem is somehow database related.

Dan,

Earlier this morning I sent you Locomotive instructions on the Studio
attendee mailing list.

Mike


#12

Are you sure the database expenses_development really exists?

On 6/10/06, bbqtree removed_email_address@domain.invalid wrote:

(in /Users/wyn818/Sites/expenses)
** Invoke environment (first_time)
select' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:327:in /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’


#13

hello all i am stuck trying to run the rake migrate command. my --trace
ouput is below…i am bascially following the apple tutorial @
http://developer.apple.com/tools/rubyonrails.html… i am not sure what
the problem is. from googleing around, it may have something to do with
mysql name or permissions?
i have the rails web app running in my sites folder (using tiger 10.4.6
and followed the hivelogic tutorial). my database.yml contains the
proper username and pw to execute mysql. has there been a solution to
this? when i run rake migrate i get this:

(in /Users/wyn818/Sites/expenses)
rake aborted!
Mysql::Error: #42S02Table ‘expenses_development.schema_info’ doesn’t
exist: SELECT version FROM schema_info

(See full trace by running task with --trace)

wyn818s-computer:~/Sites/expenses wyn818$ rake -t migrate
(in /Users/wyn818/Sites/expenses)
** Invoke migrate (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
Mysql::Error: #42S02Table ‘expenses_development.schema_info’ doesn’t
exist: SELECT version FROM schema_info
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:337:in
select' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:180:inselect_one’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:306:in
current_version' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:323:incurrent_version’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:387:in
irrelevant_migration?' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:329:inmigrate’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:327:in
migrate' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:294:inup’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:285:in
migrate' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/tasks/databases.rake:4 /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:inexecute’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:ininvoke’
/usr/local/lib/ruby/1.8/thread.rb:135:in synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in
invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:ineach’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in
invoke_prerequisites' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:ininvoke’
/usr/local/lib/ruby/1.8/thread.rb:135:in synchronize' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in run' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:inrun’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/usr/local/bin/rake:18


#14

On 6/10/06, bbqTree removed_email_address@domain.invalid wrote:

here is where i think the problem may be…

there are 2 users that have their own view of whats in mysql? when i
open a terminal and do the regular mysql command and show databases, i
dont see anything…when i log into mysql using root as my name, i see
the expenses_development database. maybe when running “rake migrate”, it
thinks i am using the ‘non root’ view? (i created the
expenses_development with root as my un)

You’re better off using a non-root user anyway.

You can set permissions with the GRANT command while logged into mysql
as the root user.

http://dev.mysql.com/doc/refman/5.0/en/grant.html

After you do this, you’ll want to run ‘mysqladmin reload’ from a
command prompt so that your GRANT changes take effect.

Also keep in mind that sometimes you’ll need to set permissions for
both username and username@localhost. Check the docs for details on
that.

– James


#15

hi, thanks james…

yup that was the problem. i created the database using the ‘root’
username
but not the ‘real’ root. so i created the database using my login name
and granted user ‘root’ to the database and walaa! perfecto!

phew,now i can keep trudging along

James L. wrote:

On 6/10/06, bbqTree removed_email_address@domain.invalid wrote:

here is where i think the problem may be…

there are 2 users that have their own view of whats in mysql? when i
open a terminal and do the regular mysql command and show databases, i
dont see anything…when i log into mysql using root as my name, i see
the expenses_development database. maybe when running “rake migrate”, it
thinks i am using the ‘non root’ view? (i created the
expenses_development with root as my un)

You’re better off using a non-root user anyway.

You can set permissions with the GRANT command while logged into mysql
as the root user.

http://dev.mysql.com/doc/refman/5.0/en/grant.html

After you do this, you’ll want to run ‘mysqladmin reload’ from a
command prompt so that your GRANT changes take effect.

Also keep in mind that sometimes you’ll need to set permissions for
both username and username@localhost. Check the docs for details on
that.

– James


#16

here is where i think the problem may be…

there are 2 users that have their own view of whats in mysql? when i
open a terminal and do the regular mysql command and show databases, i
dont see anything…when i log into mysql using root as my name, i see
the expenses_development database. maybe when running “rake migrate”, it
thinks i am using the ‘non root’ view? (i created the
expenses_development with root as my un)

thanks

Jón Borgþórsson wrote:

Are you sure the database expenses_development really exists?

On 6/10/06, bbqtree removed_email_address@domain.invalid wrote:

(in /Users/wyn818/Sites/expenses)
** Invoke environment (first_time)
select' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:327:in /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:ininvoke’
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’