This forum is now read-only. Please use our new forums at

Introduction to Twitter's API Forum

View Course » View Exercise

1031 points
Submitted by
James White
over 5 years ago

How to put this in an external file?

I want to play around with this code so I copied it into an external editor, saved, and ran it and got this error:

/Users/jody/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/siteruby/1.9.1/rubygems/customrequire.rb:36:in require': cannot load such file -- oauth (LoadError)
from /Users/jody/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
from twitter.rb:2:in `'

What do I need to do to pull in the "require" pieces? I'm assuming that's where my problem is. I need to install an oauth, json, and rubygems gem?

3 votes


That's correct, James. You'll need to install the gems that you specify in the "require" section.

If you have rubygems installed, simply run:

gem install oauth

657 points
Submitted by
Brandon Presley
about 5 years ago

0 votes


I get a similar error when I try to run the example code in BBEdit, but I do have the oauth gem installed. Does it need to be located in a specific folder? Currently it resides in /Users/Raevynheart/.rvm/gems/ruby-2.0.0-p195/bin/oauth on my machine. Below is the exact error I'm getting:

`require': cannot load such file --
oauth (LoadError) from
require' from

Running the file directly from Terminal works without issue. I'd be grateful if someone can point out what I'm doing wrong. Thanks.

1772 points
Submitted by
almost 5 years ago


Picture Brandon Presley almost 5 years ago

What version of ruby are you running in Terminal?

82a2972b58bab04772387ee8ff79e20f?s=140&d=retro o almost 5 years ago

When I run 'ruby -v' I get:

ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]