This project is archived and is in readonly mode.

#2938 ✓wontfix
Kieran P

railties/bin/rails non-operational in current clone of master

Reported by Kieran P | July 22nd, 2009 @ 10:48 AM | in 3.0.2

The current railties/bin/rails has issues running on the latest version of master.

The script assumes bash because no interpreter is given in the file.

Following the example of other script files, I added

#!/usr/bin/env ruby

at the top of the script, and the script became functional again.

Comments and changes to this ticket

  • Kieran P

    Kieran P August 7th, 2009 @ 11:51 AM

    This problem still exists in the latest clone of master.

  • José Valim

    José Valim August 7th, 2009 @ 04:09 PM

    • Assigned user changed from “Yehuda Katz (wycats)” to “José Valim”
    • Milestone cleared.


    I have them working on my ubuntu.
    Before you add the line above, what was the first line?

  • Kieran P

    Kieran P August 7th, 2009 @ 09:09 PM

    The first line is

    require File.dirname(__FILE__) + '/../lib/ruby_version_check'

    Which is clearly ruby, but when I run ./rails/railties/bin/rails it interprets it as a bash script.

    The interpreter declaration (which is present in all other bin scripts within Rails that I've found, including the script files in a new Rails app) fixes this issue.

    The other solution is to use

    ruby rails/railties/bin/rails

    but I really don't think that is very friendly.

  • José Valim

    José Valim August 7th, 2009 @ 09:17 PM

    • State changed from “new” to “open”

    Sorry, I got it wrong. For me you couldn't run RAILS_ROOT/scripts/* files.
    I will fix that. Thanks!

  • Kieran P

    Kieran P August 7th, 2009 @ 09:29 PM

    • Title changed from “script/rails non-operational in current clone of master” to “railties/bin/rails non-operational in current clone of master”

    Ah, sorry. Poorly worded original ticket. Correcting it now.

  • Rizwan Reza

    Rizwan Reza August 9th, 2009 @ 12:25 AM


    +1 This is still present in master branch. I cannot seem to run rails command by running.

    But I still think this is intentional. Just because 2-3-stable has it the same way. Please invalidate if this isn't a bug.

  • José Valim

    José Valim August 9th, 2009 @ 12:30 AM

    • State changed from “open” to “wontfix”

    Rails should not add a shebang to the bin files. When you install a gem, rubygems creates this:

    # This file was generated by RubyGems.
    # The application 'rails' is installed as part of a gem, and
    # this file is here to facilitate running it.
    require 'rubygems'
    version = ">= 0"
    if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
      version = $1
    gem 'rails', version
    load 'rails'

    In other words, rubygems is responsible for adding the shebang. If you run it from your fork, unfortunately you will have to give the whole path.

  • Steve St. Martin

    Steve St. Martin August 9th, 2009 @ 12:52 AM

    -1 agreed this was probably removed from master due to rubygems, therefore this issue will only exist when using a checkout rather then a gem, running 'ruby rails/railties/bin/rails' is acceptable.

  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “High”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket