Skip to content


Subversion checkout URL

You can clone with
Download ZIP


poll vs inotify vs fsevent #340

rking opened this Issue · 6 comments

2 participants


So, there's an issue with cross-platform development.

Guard is happiest when it has something other than polling, of course, so the naïve Linuxer adds this to his Gemfile:

gem 'rb-inotify'

Then he makes his OS X coworker so sad when that won't install. The OS X
coworker then does:

when /linux/i
  gem 'rb-inotify'
when /darwin/i
  gem 'rb-fsevent'

And it sort of works, but then he ends up comitting a diff into Gemfile.lock
removing rb-inotify and adding rb-fsevent. Then the two play
tug-of-Gemfile.lock until one or the other ragequits the project.

I talked to @injekt, and he said it would be nice if Gemfile.locks had
platform-specific blocks, but there are issues with that (e.g. you can't
extend the grammar of Gemfile.lock without causing existing Bundlers to blow

I kicked around a few dumb ideas, but (thanks to @rf-) I think we've got a
non-dumb idea to propose:

Step 1: Create a generic polling gem that does the job of guards poll stuff plus a conditional, optional C piece for either libnotify or libfsevent.
Step 2: Depend on it, unconditionally.
Step 3: Figure out what the user experience should be if they're on Linux without libnotify, etc.

BTW my proposed name for this thing is either libfisneovteinfty or
libifnsoetviefnyt. Just (mostly) kidding. :neckbeard:


Hi @rking,

We already have that discussion for the Listen gem:

In your case the solution would be to required all dependencies without the RUBY_PLATFORM case:

  gem 'rb-inotify'
  gem 'rb-fsevent'

It should work everywhere. (Listen was using this approach first).

@thibaudgg thibaudgg closed this

Oh man, that's so simple.

I don't think I can climb out of the idiot hole on this one, but for what it's
worth, these don't say the gems work fine on other OS's:

(And, interestingly, the wdm gem does not behave in this mild-mannered manner).

Thanks for the solution, though!


(rb-fchange actually doesn't complain when you gem install it, but it does complain when you require it — but it's not mentioned on the guard


Ok, just add :require => false on your Gemfile. Listen will automatically require the good one.

  gem 'rb-inotify', :require => false
  gem 'rb-fsevent', :require => false
  gem 'rb-fchange', :require => false

Looks good to me. Could this be added to the docs (or perhaps be made part of guard/listen)?


Yeah adding that in the Guard README is a good idea, can you submit a pull request please? Thanks.

@rking rking referenced this issue from a commit in rking/guard
@rking rking Update for Gemfile solution. Addresses #340.
Note that I dropped the mention of the `wdm` gem. I don't see that it
does something better than `rb-fchange`, and it also fails loudly upon
attempted install onto Linux.
@rking rking referenced this issue in Maher4Ever/wdm

Install + Run on Non-Windows #6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.