Ruby: make gems available to your command-line .rb script
If you add a require line to a command line Ruby script, like this:
require 'tzinfo'
…it will fail to find the library unless you’ve done one of the steps below.
Include rubygems at runtime
When running your script, use:ruby -rubygems my_program_that_uses_gems
Easier: set the RUBYOPT environment variable to always include gems
Edit .bash_profile and add:export RUBYOPT=rubygems
Easiest: include rubygems on your shebang line
#!/usr/bin/ruby -rubygems
More…