I have been troubleshooting a very odd issue in my local development rails setup for some time now. While I can not track exactly when it started I wanted to post this to see if anyone else has seen this issue or has ideas on how to fix it.
How to duplicate this error. I startup iterm2 (zsh) and in the first tab in my project I run rails s
to start the server. As most developers do, I hit cmd+t to open a new tab and when I attempt to run rails c
the rails console this error displays. It's like I am restricted to a single tab. I have found little research or direction online as to where to go with this issue and I am hoping someone out there could point me in the right direction.
It appears to be failing on the PG gem and I already verified I am running the latest version.
My .zshrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
export PATH=/Users/chrishough:/Users/chrishough/.rvm/gems/ruby-1.9.3-head/bin:/Users/chrishough/.rvm/gems/ruby-1.9.3-head@global/bin:/Users/chrishough/.rvm/rubies/ruby-1.9.3-head/bin:/Users/chrishoug$
Here is a copy of the exact error that pops up in terminal.
/Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle: dlopen(/Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle, 9): Symbol not found: _rb_eEncCompatError (LoadError)
Referenced from: /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle
Expected in: flat namespace
in /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle - /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg.rb:4
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:13
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/railties-3.2.11/lib/rails/commands.rb:39:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/railties-3.2.11/lib/rails/commands.rb:39
from script/rails:6:in `require'
from script/rails:6
Thank you so much for your help everyone. Have a great weekend.
UPDATE
From @crazymykl I updated my .zshrc config to look like this and the error appears to have gone away.
# RUBY DEVELOPMENT
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
# export PATH=/Users/chrishough:/Users/chrishough/.rvm/gems/ruby-1.9.3-head/bin:/Users/chrishough/.rvm/gems/ruby-1.9.3-head@global/bin:/Users/chrishough/.rvm/rubies/ruby-1.9.3-head/bin:/Users/chrishoug$
Thoughts?
The root of your issue is that your .zshrc refers to ruby-1.9.3-head
, and it's looking at ruby-1.9.3-p374
to find the pg_ext.bundle. Mismatched versions cause all sorts of oddness.