NameError: uninitialized constant

I recently opened up pry, ran this:

but got this:

Not greatly helpful.

It turned out that, despite adding it to my Gemfile and running

I still needed to require the file in pry.

However, the name of the file isn’t obvious if it’s not your own gem. E.g.

Eventually it seemed to be correct:

but this didn’t work:

but by looking at the gem file name via:

I eventually used:

which worked. E.g.

This all seems a lot of guess work.

What I’d like to see (and I’m sure there must be a way of doing this but Google’ing and searching StackOverflow has not turned anything up) is something like this:

Ruby LoadError

Ever get this message?

/Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- <some_gem_i_need> (LoadError)
from /Users/me/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
from <your_script>.rb:1:in `<main>’

You and Ruby may have different ideas exactly where that gem was installed.

For example, you could have used sudo when installing a gem and installed it at a path that Ruby wasn’t expecting or can’t access. Try using plain old ‘gem install’

How to make a Ruby script into a daemon process

Use Daemons.


gem install daemons

2. Then, say you have myserver.rb, create a control script, myserver_control.rb, like this:

3. and use it from the console like this:


Cinch – super simple IRC bots

Here’s an example of a simple IRC bot using Cinch:

require ‘cinch’

bot = do
configure do |c|
c.server = “”
c.channels = [“#cinch-bots”]

on :message, “hello” do |m|
m.reply “Hello, #{m.user.nick}”


Just install using:

gem install cinch

Getting Started (in Markdown):

and the docs:

Other IRC Bot frameworks: