There are a couple of libraries which I usually include in my Gemfiles because they make Guard more awesome on Ubuntu. However, they don’t make sense to require on other platforms, and they probably don’t even compile when not on Linux.
As far as I can tell, there’s no “official” way to conditionally include gems in a Gemfile based on the current OS platform. Or at least there wasn’t the last time I looked at the Bundler documentation. Fortunately a Gemfile is just Ruby, so that’s not really a limitation.
So here’s what I put in my Gemfile:
group :test, :development do # ... gem 'rb-inotify' if RUBY_PLATFORM =~ /linux/i gem 'libnotify' if RUBY_PLATFORM =~ /linux/i end
This works well for me, but if there’s a better way I’d love to know it.