Ben W
Ben W

Reputation: 1324

.irbrc doesn't execute after installing RBEnv

I just changed over from RVM to RBEnv (+ruby-build). I have a custom .irbrc file, but after the rbenv install, it doesn't seem to execute it. This on OS X Lion.

I have updated .bash_profile with:

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

not sure if this is needed to help, but which irb shows:

/Users/me/.rbenv/shims/irb

also, echo $PATH give:

/Users/me/.rbenv/shims:/Users/me/.rbenv/bin:/opt/local/bin/bundle:/opt/local/bin/ruby:/opt/local/bin:/opt/local/sbin::/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Thoughts? Thanks in advance!

Upvotes: 5

Views: 621

Answers (1)

superuseroi
superuseroi

Reputation: 1348

Ok, I was having the same exact issue and took me some time to figure out, I thought I'd share as people may land here.

the main problem with .irbrc is that it will fail silently, thus it makes less obvious to debug. In my case it turns out that a gem could not be found and threw a LoadError exception which prevented .irbrc to be evaluated.

a good first step would be comment out every single line in your .irbrc and only leave something like

puts "loading .irbrc all working fine so far"

In this way you at least know it loads. If it does uncomment the original code and "spray" it with some puts statements to determine where it stops loading.

The most likely cause is that some code throws some kind of exception that prevents it to load. Hope this helps others.

Upvotes: 3

Related Questions