# Can't load gems

**URL:** <https://rubytalk.org/t/cant-load-gems/67285>\
**Category:** ruby-talk\
**Created:** [14 February 2013 00:37 UTC](https://rubytalk.org/t/cant-load-gems/67285 "2013-02-14T00:37:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [14 February 2013 00:37 UTC](https://rubytalk.org/t/cant-load-gems/67285/1 "2013-02-14T00:37:26Z")

</div>

I have installed rvm on my Mac OSX and Ruby 1.9.3 and I also installed  
rails.

I created my own gem which is successfully installed with gem install.

If I enter the command "gem list", I get a long list of gems, mostly  
rails and also my own installed gem.

But if I try to require any of these gems in my source code,  
'actionmailer' for instance, I get a load error

in `require': cannot load such file -- actionmailer (LoadError)

Here is my source code:

puts $:

require 'actionmailer'

and here is the output:

/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1/x86\_64-darwin12.2.0  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby/1.9.1/x86\_64-darwin12.2.0  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/x86\_64-darwin12.2.0  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require': cannot load such file -- actionmailer (LoadError)  
&nbsp;&nbsp;from  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require'  
&nbsp;&nbsp;from ../ruby-1.9.3/test\_timecode.rb:3:in `\<main\>'

The gems are actually installed in  
/Users/kary/.rvm/gems/ruby-1.9.3-p286/gems

bash-3.2$ rvm gemdir  
/Users/kary/.rvm/gems/ruby-1.9.3-p286

Why can't Ruby find my gems when I require them?

Thanks in advance

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 February 2013 00:58 UTC](https://rubytalk.org/t/cant-load-gems/67285/2 "2013-02-14T00:58:18Z")

</div>

To start, make sure that `which gem` and `which ruby` are answering with the same install.

> **···**
>
> On Feb 13, 2013, at 16:37 , Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> > Why can't Ruby find my gems when I require them?

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [14 February 2013 05:21 UTC](https://rubytalk.org/t/cant-load-gems/67285/3 "2013-02-14T05:21:48Z")

</div>

Ryan Davis wrote in post #1096802:

> > Why can't Ruby find my gems when I require them?
> 
> To start, make sure that `which gem` and `which ruby` are answering with  
> the same install.

Sure, thanks.

bash-3.2$ which ruby  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/bin/ruby  
bash-3.2$ which gem  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/bin/gem  
bash-3.2$ gem list actionmailer

\*\*\* LOCAL GEMS \*\*\*

actionmailer (3.2.9)  
bash-3.2$ gem which actionmailer  
ERROR: Can't find ruby library file or shared library actionmailer

> **···**
>
> > On Feb 13, 2013, at 16:37 , Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 February 2013 07:59 UTC](https://rubytalk.org/t/cant-load-gems/67285/4 "2013-02-14T07:59:54Z")

</div>

% gem which minitest  
ERROR: Can't find ruby library file or shared library minitest

% gem contents minitest | grep lib  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/hoe/minitest.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/autorun.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/benchmark.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/hell.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/mock.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/parallel\_each.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/pride.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/spec.rb  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/unit.rb

% gem which minitest/unit  
/Library/Ruby/Gems/1.8/gems/minitest-4.6.0/lib/minitest/unit.rb

There is no minitest.rb so it bitches. There is a minitest/unit.rb so it finds it. The easiest way to figure that out is to just look. I used `gem contents` to do that but I also often just go into the code and poke around.

In your case, there is no actionmailer.rb, however, there is an action\_mailer.rb

10006 % pwd  
/Users/ryan/Work/git/rails/actionmailer/  
10007 % l lib  
total 8  
0 action\_mailer/ 8 action\_mailer.rb 0 rails/

> **···**
>
> On Feb 13, 2013, at 21:21 , Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> > Ryan Davis wrote in post #1096802:
> > 
> > > On Feb 13, 2013, at 16:37 , Loran Kary \<lists@ruby-forum.com\> wrote:
> > > 
> > > > Why can't Ruby find my gems when I require them?
> > > 
> > > To start, make sure that `which gem` and `which ruby` are answering with  
> > > the same install.
> > 
> > Sure, thanks.
> > 
> > bash-3.2$ which ruby  
> > /Users/kary/.rvm/rubies/ruby-1.9.3-p286/bin/ruby  
> > bash-3.2$ which gem  
> > /Users/kary/.rvm/rubies/ruby-1.9.3-p286/bin/gem  
> > bash-3.2$ gem list actionmailer
> > 
> > \*\*\* LOCAL GEMS \*\*\*
> > 
> > actionmailer (3.2.9)  
> > bash-3.2$ gem which actionmailer  
> > ERROR: Can't find ruby library file or shared library actionmailer

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 February 2013 08:00 UTC](https://rubytalk.org/t/cant-load-gems/67285/5 "2013-02-14T08:00:34Z")

</div>

P.S. Sorry I didn't see that sooner. I don't primarily do rails so I didn't notice.

> **···**
>
> On Feb 13, 2013, at 23:59 , Ryan Davis \<ryand-ruby@zenspider.com\> wrote:
> 
> > In your case, there is no actionmailer.rb, however, there is an action\_mailer.rb

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [14 February 2013 18:46 UTC](https://rubytalk.org/t/cant-load-gems/67285/6 "2013-02-14T18:46:50Z")

</div>

Ryan Davis wrote in post #1096838:

> There is no minitest.rb so it bitches. There is a minitest/unit.rb so it  
> finds it. The easiest way to figure that out is to just look. I used  
> `gem contents` to do that but I also often just go into the code and  
> poke around.
> 
> In your case, there is no actionmailer.rb, however, there is an  
> action\_mailer.rb

Thanks Ryan, for that help. Actually, I was just using actionmailer as  
an example, because it came at the top of my list of installed gems.

My real problem is that I cannot load my own gem which I created and  
installed myself. I call it 'timecode.

bash-3.2$ gem list timecode

\*\*\* LOCAL GEMS \*\*\*

timecode (0.0.1)  
bash-3.2$ gem contents timecode | grep lib  
/Users/kary/.rvm/gems/ruby-1.9.3-p286/gems/timecode-0.0.1/lib/timecode.rb  
bash-3.2$ gem which timecode  
ERROR: Can't find ruby library file or shared library timecode

As you can see, there is a lib/timecode.rb yet it won't load.

/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require': cannot load such file -- timecode (LoadError)

Should I be concerned that I do not see any gems directory in my  
LOAD\_PATH?

/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby/1.9.1/x86\_64-darwin12.2.0  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/site\_ruby  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby/1.9.1/x86\_64-darwin12.2.0  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/vendor\_ruby  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1  
/Users/kary/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/x86\_64-darwin12.2.0

bash-3.2$ gem env  
RubyGems Environment:  
&nbsp;&nbsp;- RUBYGEMS VERSION: 1.8.24  
&nbsp;&nbsp;- RUBY VERSION: 1.9.3 (2012-10-12 patchlevel 286)  
[x86\_64-darwin12.2.0]  
&nbsp;&nbsp;- INSTALLATION DIRECTORY: /Users/kary/.rvm/gems/ruby-1.9.3-p286  
&nbsp;&nbsp;- RUBY EXECUTABLE: /Users/kary/.rvm/rubies/ruby-1.9.3-p286/bin/ruby  
&nbsp;&nbsp;- EXECUTABLE DIRECTORY: /Users/kary/.rvm/gems/ruby-1.9.3-p286/bin  
&nbsp;&nbsp;- RUBYGEMS PLATFORMS:  
&nbsp;&nbsp;&nbsp;&nbsp;- ruby  
&nbsp;&nbsp;&nbsp;&nbsp;- x86\_64-darwin-12  
&nbsp;&nbsp;- GEM PATHS:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /Users/kary/.rvm/gems/ruby-1.9.3-p286  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- /Users/kary/.rvm/gems/ruby-1.9.3-p286@global  
&nbsp;&nbsp;- GEM CONFIGURATION:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- :update\_sources =\> true  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- :verbose =\> true  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- :benchmark =\> false  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- :backtrace =\> false  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- :bulk\_threshold =\> 1000  
&nbsp;&nbsp;- REMOTE SOURCES:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- [http://rubygems.org/](http://rubygems.org/)

bash-3.2$ echo $GEM\_PATH  
/Users/kary/.rvm/gems/ruby-1.9.3-p286:/Users/kary/.rvm/gems/ruby-1.9.3-p286@global

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 February 2013 19:28 UTC](https://rubytalk.org/t/cant-load-gems/67285/7 "2013-02-14T19:28:17Z")

</div>

Lets assume that your rubygems is not borked, yet.

Show me 'gem spec timecode'

> **···**
>
> On Feb 14, 2013, at 10:46, Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> > My real problem is that I cannot load my own gem which I created and  
> > installed myself. I call it 'timecode.
> > 
> > bash-3.2$ gem list timecode
> > 
> > \*\*\* LOCAL GEMS \*\*\*
> > 
> > timecode (0.0.1)  
> > bash-3.2$ gem contents timecode | grep lib  
> > /Users/kary/.rvm/gems/ruby-1.9.3-p286/gems/timecode-0.0.1/lib/timecode.rb  
> > bash-3.2$ gem which timecode  
> > ERROR: Can't find ruby library file or shared library timecode
> > 
> > As you can see, there is a lib/timecode.rb yet it won't load.

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [14 February 2013 20:07 UTC](https://rubytalk.org/t/cant-load-gems/67285/8 "2013-02-14T20:07:14Z")

</div>

Ryan Davis wrote in post #1096950:

> > bash-3.2$ gem which timecode  
> > ERROR: Can't find ruby library file or shared library timecode
> > 
> > As you can see, there is a lib/timecode.rb yet it won't load.
> 
> Lets assume that your rubygems is not borked, yet.
> 
> Show me 'gem spec timecode'

borked ???

To avoid conflicts, I have renamed my gem fps-timecode. But it behaves  
the same.

bash-3.2$ gem spec fps-timecode  
--- !ruby/object:Gem::Specification  
name: fps-timecode  
version: !ruby/object:Gem::Version  
&nbsp;&nbsp;version: 0.0.1  
&nbsp;&nbsp;prerelease:  
&nbsp;&nbsp;segments:  
&nbsp;&nbsp;- 0  
&nbsp;&nbsp;- 0  
&nbsp;&nbsp;- 1  
platform: ruby  
authors:  
- Loran Kary  
autorequire:  
bindir: bin  
cert\_chain:   
date: 2013-02-14 00:00:00.000000000 Z  
dependencies:   
description: A library to support drop-frame and non-drop-frame  
timecodes  
email: kary@focalpnt.com  
executables:   
extensions:   
extra\_rdoc\_files:   
files:   
homepage:  
licenses:   
post\_install\_message:  
rdoc\_options:   
require\_paths:  
- .  
required\_ruby\_version: !ruby/object:Gem::Requirement  
&nbsp;&nbsp;none: false  
&nbsp;&nbsp;requirements:  
&nbsp;&nbsp;- - ! '\>='  
&nbsp;&nbsp;&nbsp;&nbsp;- !ruby/object:Gem::Version  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version: '1.9'  
required\_rubygems\_version: !ruby/object:Gem::Requirement  
&nbsp;&nbsp;none: false  
&nbsp;&nbsp;requirements:  
&nbsp;&nbsp;- - ! '\>='  
&nbsp;&nbsp;&nbsp;&nbsp;- !ruby/object:Gem::Version  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version: '0'  
requirements:   
rubyforge\_project:  
rubygems\_version: 1.8.24  
signing\_key:  
specification\_version: 3  
summary: Implements timecode class  
test\_files:

> **···**
>
> > On Feb 14, 2013, at 10:46, Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Ryan\_Davis1](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/ryan_davis1/32/1848_2.png) [@Ryan\_Davis1](https://rubytalk.org/u/Ryan_Davis1)\
**Post date:** [14 February 2013 23:26 UTC](https://rubytalk.org/t/cant-load-gems/67285/9 "2013-02-14T23:26:57Z")

</div>

> Ryan Davis wrote in post #1096950:
> 
> > > bash-3.2$ gem which timecode  
> > > ERROR: Can't find ruby library file or shared library timecode
> > > 
> > > As you can see, there is a lib/timecode.rb yet it won't load.
> > 
> > Lets assume that your rubygems is not borked, yet.
> > 
> > Show me 'gem spec timecode'
> 
> borked ???
> 
> To avoid conflicts, I have renamed my gem fps-timecode. But it behaves  
> the same.
> 
> bash-3.2$ gem spec fps-timecode  
> --- !ruby/object:Gem::Specification  
> name: fps-timecode  
> version: !ruby/object:Gem::Version  
> version: 0.0.1  
> prerelease:  
> segments:  
> - 0  
> - 0  
> - 1  
> platform: ruby  
> authors:  
> - Loran Kary  
> autorequire:  
> bindir: bin  
> cert\_chain:   
> date: 2013-02-14 00:00:00.000000000 Z  
> dependencies:   
> description: A library to support drop-frame and non-drop-frame  
> timecodes  
> email: kary@focalpnt.com  
> executables:   
> extensions:   
> extra\_rdoc\_files:   
> files:

BOOM. I suggest you use a tool like Hoe to manage your gem. It deals with all the gem/project minutia for you.

> **···**
>
> On Feb 14, 2013, at 12:07 , Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> > > On Feb 14, 2013, at 10:46, Loran Kary \<lists@ruby-forum.com\> wrote:
> 
> > homepage:  
> > licenses:   
> > post\_install\_message:  
> > rdoc\_options:   
> > require\_paths:  
> > - .  
> > required\_ruby\_version: !ruby/object:Gem::Requirement  
> > none: false  
> > requirements:  
> > - - ! '\>='  
> > &nbsp;&nbsp;&nbsp;- !ruby/object:Gem::Version  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version: '1.9'  
> > required\_rubygems\_version: !ruby/object:Gem::Requirement  
> > none: false  
> > requirements:  
> > - - ! '\>='  
> > &nbsp;&nbsp;&nbsp;- !ruby/object:Gem::Version  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;version: '0'  
> > requirements:   
> > rubyforge\_project:  
> > rubygems\_version: 1.8.24  
> > signing\_key:  
> > specification\_version: 3  
> > summary: Implements timecode class  
> > test\_files:
> > 
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [15 February 2013 00:59 UTC](https://rubytalk.org/t/cant-load-gems/67285/10 "2013-02-15T00:59:06Z")

</div>

Ryan Davis wrote in post #1096979:

> **···**
>
> > On Feb 14, 2013, at 12:07 , Loran Kary \<lists@ruby-forum.com\> wrote:
> > 
> > > > Show me 'gem spec timecode'
> > > 
> > > version: 0.0.1  
> > > cert\_chain:   
> > > date: 2013-02-14 00:00:00.000000000 Z  
> > > dependencies:   
> > > description: A library to support drop-frame and non-drop-frame  
> > > timecodes  
> > > email: kary@focalpnt.com  
> > > executables:   
> > > extensions:   
> > > extra\_rdoc\_files:   
> > > files:
> > 
> > BOOM. I suggest you use a tool like Hoe to manage your gem. It deals  
> > with all the gem/project minutia for you.
> 
> I gather that you see something wrong with the gemspec, though you don't  
> say what exactly.
> 
> I fiddled with it a little and now it works! Thanks for your help in  
> pointing me to the problem. Most likely it was an incorrect  
> require\_path.
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
