Ruby Gem Guard on Ubuntu, no 'guard' command
Asked Answered
P

3

5

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?

Pickaninny answered 30/7, 2011 at 12:49 Comment(2)
What gem did you install in your Gemfile? Some guard-* gems lack a dependency on guard, for example guard-test. You have to specify them both.Fusco
My apologies, this question was asked 6 years ago and I have no recollection now. Judging by the answer I accepted, the problem was resolved by using RVM instead of the "out of the box" ubuntu ruby stuff.Pickaninny
S
3

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

Spacing answered 30/7, 2011 at 14:38 Comment(2)
I sudo install all my gems. gem "guard-rspec" is in the gemfile. Am on Ubuntu 11.04, 2 different machines have given me the same error.Pickaninny
I have adjusted my answer accordingly. Don't use sudo :)Spacing
L
10

Try bundle exec guard [rest of command].

Loki answered 29/2, 2012 at 4:20 Comment(1)
This was the fix for me--not sure why I didn't think of it. I'm using Fedora 17 with RBENV and I just added 'guard-rspec' to my Gemfile. I'll probably build an alias in my bash profile so I don't have to prefix 'bundle exec' anymore.Thrill
S
3

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

Spacing answered 30/7, 2011 at 14:38 Comment(2)
I sudo install all my gems. gem "guard-rspec" is in the gemfile. Am on Ubuntu 11.04, 2 different machines have given me the same error.Pickaninny
I have adjusted my answer accordingly. Don't use sudo :)Spacing
C
2

Try

gem install guard

or add

gem 'guard', '~> 2.14', '>= 2.14.1'

to the Gemfile. Run

bundle install

See Guard docs

Corncob answered 14/5, 2017 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.