9

I am totally new to RoR. I am following Michael Hartl's book. I am not able to make autotest run. Please suggest what's going wrong and a solution to fix it.

When I run 'autotest' at command line inside Rails project directory i get following:

-bash: autotest: command not found

When I run 'bundle exec autotest' I get following:

 bundler: command not found: autotest
 Install missing gem binaries with `bundle install'

Here is the Gemfile

source 'http://rubygems.org'

gem 'rails', '3.0.3'
gem 'sqlite3-ruby', :require => 'sqlite3'

group :development do
gem 'autotest'
gem 'rspec-rails', '2.4.1' 
end

group :test do
gem 'rspec', '2.4.0'
gem 'webrat', '0.7.1'
end

Here is the output from 'gem list'

abstract (1.0.0)
actionmailer (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.3.6)
actionpack (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.13.6)
actionwebservice (1.2.6)
activeresource (3.0.7, 3.0.6, 3.0.3, 2.3.5)
activesupport (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.4.4)
acts_as_ferret (0.4.3)
arel (2.0.9)
autotest (4.4.6)
autotest-fsevent (0.2.5)
autotest-growl (0.2.9)
autotest-notification (2.3.1)
autotest-rails-pure (4.1.2)
builder (2.1.2)
bundler (1.0.12)
capistrano (2.5.2)
cgi_multipart_eof_fix (2.5.0)
configuration (1.2.0)
daemons (1.0.10)
diff-lcs (1.1.2)
dnssd (0.6.0)
erubis (2.6.6) 
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6)
gem_plugin (0.2.3)
heroku (2.0.4)
highline (1.5.0)
hpricot (0.6.164)
i18n (0.5.0)
launchy (0.4.0)
libxml-ruby (1.1.2)
mail (2.2.19, 2.2.15) 
mime-types (1.16)
mongrel (1.1.5)
mysql2 (0.2.7)
needle (1.3.0)
net-scp (1.0.1)
net-sftp (2.0.1, 1.1.1)
net-ssh (2.0.4, 1.1.4)
net-ssh-gateway (1.0.0)
nokogiri (1.4.4)
notifier (0.1.3)
polyglot (0.3.1)
rack (1.2.2, 1.0.1)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.7, 3.0.6, 3.0.3, 2.3.5, 1.2.6)
railties (3.0.7, 3.0.6, 3.0.3)
rake (0.8.7, 0.8.3)
RedCloth (4.1.1)
redgreen (1.2.2)
rest-client (1.6.1)
rspec (2.5.0, 2.4.0)
rspec-core (2.5.1, 2.4.0) 
rspec-expectations (2.5.0, 2.4.0)
rspec-mocks (2.5.0, 2.4.0)
rspec-rails (2.5.0, 2.4.1)
ruby-openid (2.1.2)
ruby-yadis (0.3.4)
rubygems-update (1.7.2)
rubynode (0.1.5)
spork (0.8.4)
sqlite3-ruby (1.3.2, 1.2.5, 1.2.4)
sys-uname (0.8.5)
term-ansicolor (1.0.5)
termios (0.9.4)
test_notifier (0.3.6)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27, 0.3.26)
webrat (0.7.1)
xmpp4r (0.4)
ZenTest (4.5.0)
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
aspire
  • 91
  • 1
  • 1
  • 2
  • 1
    So, did ou try to run `bundle install`? – Sergey Kishenin May 15 '11 at 16:43
  • yes..'bundle install' works fine, but autotest is not working. – aspire May 16 '11 at 05:23
  • This may not be your problem but I have seen many occasions where the binaries aren't correctly installed when using Bundler on Windows. I've had to manually uninstall the gem and install manually. Environment: Windows 7, jruby 1.6.2, Bundler, Rails3+ –  Feb 23 '12 at 19:49

6 Answers6

8

bundle install --binstubs will install all the executables from your bundle into a local bin directory in your project (see http://gembundler.com/), then you could run ./bin/autotest.

Keith Gaddis
  • 4,113
  • 23
  • 20
  • You might try RVM—remove ZenTest/autotest from the global gemset and instead install into an rvm-based gemset, see if that helps. – Keith Gaddis May 16 '11 at 13:18
  • i am lost here. Can you give me direction how to do rvm-based gemset installation? thx – aspire May 17 '11 at 05:27
  • well, first you need to get RVM installed: https://rvm.beginrescueend.com/ Then its a matter of creating an switching to a different gemset for the ruby you want to use, e.g. 1.9.2: 'rvm use 1.9.2 && rvm gemset create mygemset && rvm use 1.9.2@mygemset' – Keith Gaddis May 18 '11 at 02:53
  • instead of copying the executables to local directory, we can add the bin folder of the gems to the path as suggested here - http://stackoverflow.com/questions/3766491/autotest-with-rspec2-in-rails-3-cant-find-binaries – Kalarani Jun 23 '11 at 12:26
7

Just restart the terminal tab and try again. That should fix it.

achiinto
  • 87
  • 1
  • 3
3

I had a similar error

bundler: command not found: thin
Install missing gem executables with `bundle install`

Running the following command added the required gems:

bundle install --deployment

chips
  • 2,296
  • 2
  • 16
  • 17
  • 1
    Just an update on this answer - currently using the `--deployment` flag results in the following error: "The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set deployment 'true'`, and stop using this flag". So the new command is `bundle config set deployment 'true'` – Rick Gladwin Mar 09 '20 at 15:36
0

Make sure you put the autotest command in the test block. You seem to only have it in the development block. Then , do bundle install

thestralFeather7
  • 529
  • 2
  • 10
  • 28
0

For users of rvm:

$ rvm gemset create myapp
$ bundle install

worked for me.

joshwa
  • 1,660
  • 3
  • 17
  • 26
-3

I had the same issue but the I followed these steps and downloaded mysql. this link shows you how to do it. mysql Now I had problem with reseting with my password but once you open the second download file you would have to put the temporary password then it will ask you to change the password.