There's always:
begin require 'win32console'rescue LoadErrorendI find this easier to write and reason about that trying to decide for myself which OS I'm on and whether or not to load it.
Update: I was thinking win32console was built-in rather than a gem. I believe Win32API is available on all Windows installs, so it's a good proxy to test "Is this Windows?" (rather than "What OS is this, and is that Windows?").
begin require 'Win32API' windowsOS = truerescue LoadError windowsOS = falseendif windowsOS begin require 'win32console' rescue LoadError # Prompt user to install win32console gem endend