Ruby on Rails Friday, May 31, 2013

for what it's worth, the error message is generated in the file: gems/railties-3.2.13/lib/rails/commands.rb

On Friday, May 31, 2013 9:09:16 PM UTC-4, Rick wrote:

There are (at least) two executable ruby scripts named "rails".  The first is found in your typical search path and should be the one that gets called when you type "rails new my_app".  The second is found, after creating your new application "my_app", in the directory "my_app/script" (rails version 3) or "my_app/bin" (rails version 4).

These ruby scripts named "rails" are not the same and, if you call the second with the "new my_app" arguments, "rails" will assume you are running inside an existing application and hurl error chunks at you.

Do this

1) type the command "which rails" and you will see the full path to what your current shell assumes to be the true rails command. 

i.e. on my system
555 > which rails
 556 >

2) type the command "wc -l `which rails`" -- if you can't figure out the quoting just use the result of step 1.  i.e. on my system "which /opt/local/bin/rails"

you should see a result that is somewhere around 23 (lines) but i'm thinking you'll see 6.  the first number is the correct system wide rails script that will let you create a new app, the second number is the rails script that is placed into "my_app/script" (or "my_app/bin") and will be used when you "rails generate ..." or other such inside your new application directory structure.

just to beat this horse to death, here's what i get when, in my home directory, i call an application (6 line) rails with new...

561 > binky/script/rails new boffo
Can't initialize a new Rails application within the directory of another, please change to a non-Rails directory first.
Type 'rails' for help.
 562 >

look familiar?

On Friday, May 31, 2013 6:28:06 PM UTC-4, User wrote:
Im a new user - I just installed rails, following directions here:
however, when it came time to make a rails new path/etc/etc I get this
Can't initialize a new Rails application within the directory of
another, please change to a non-Rails directory first.
The only complication during the download was that I had to upgrade from
version 1.8.6 to 1.9.3, which I did after installing rails. Otherwise
Ive done nothing but follow the very simple directions.
I found this very helpful thread
but when the output of ls -l shows just my usual directories. Any help
is greatly appreciated.

Posted via

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment