Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby Gem Guard on Ubuntu, no 'guard' command

Trying to install Guard on my ubuntu machine, but when I try to run it from command line I get this error:

No command 'guard' found, did you mean:
 Command 'guards' from package 'quilt' (main)
guard: command not found

All my other gems work fine from command line, so the gems path is good. gem list shows guard (0.5.1) and guard-rspec (0.4.0). I also installed libnotify and rb-inotify

What am I missing?

like image 852
Lee Quarella Avatar asked Jul 30 '11 12:07

Lee Quarella


2 Answers

Try bundle exec guard [rest of command].

like image 200
David Xia Avatar answered Oct 04 '22 12:10

David Xia


I had no issues setting up the guard-rspec gem on Ubuntu. I assume you do not use sudo to install your gems. This would cause a problem.

Update in response to comment regarding installing gems using sudo.

If you sudo gem install - which you really should not do - then your terminal will have no access to the gem. If this is the case then uninstall all your gems then re-install using bundle, rvm or whatever without the sudo command. On Ubuntu when you use the command shell you are not logged in as root.

I highly recommend you use rvm to manage your gems. They will be installed to your home folder See here for more details https://rvm.io End of update

If your really have to sudo install your gems then you will have to sudo run them as well and as your app is not run under a sudo shell this will cause issues.

I suggest you check the name of your gem in your gemfile.rb it should be gem "guard-rspec"

define this in your test group and make sure you run bundle install.

One major benefit of using Ubuntu is that you can also use the libnotify and libnotify-rails gems which work beautifully well. You will see a message about this after you have run guard rspec:install and then guard for the first time. Check the messages carefully you will be very pleasantly surprised.

The libnotify gems give you a popup window that tells you the state of your tests every time they run. It's totally awesome

like image 23
jamesc Avatar answered Oct 04 '22 12:10

jamesc