2

I have installed homebrew on my Mac, but no matter what brew command I run, I get:

/usr/local/bin/brew:6:in `require': no such file to load -- pathname (LoadError)
from /usr/local/bin/brew:6

I am using zsh and I believe I have the right $PATH (but I could be wrong...)

Any ideas where I should look to fix this?


Update: My issue doesn't really have much to do with homebrew as it seems to be related to a broken installation of Ruby.

I still need to fix my Ruby install nonetheless.

fighella
  • 121
  • 1
  • 4
  • 1
    Where is your `ruby` installation? Which version do you use? `pathname` is a core library in Ruby so if that doesn't work, your Ruby installation seems broken. – slhck Jun 01 '11 at 13:41
  • so if my ruby install was "broken" how would i best fix it? I have followed these instructions http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/ (a few times) but it doesnt solve my problem... – fighella Jun 01 '11 at 14:09
  • My quick fix would probably be to install a newer Ruby (e.g. 1.9.2) with [rvm](https://rvm.beginrescueend.com/) instead of doing it manually. I use that setup with Homebrew and it works quite well. – slhck Jun 01 '11 at 14:21
  • and that's exactly what I've done thats got me here. "/usr/local/bin/brew:6:in `require': no such file to load -- pathname (LoadError) from /usr/local/bin/brew:6" – fighella Jun 01 '11 at 14:42
  • 1
    No, I was guessing you installed a system-wide Ruby manually before, *not* with rvm. – slhck Jun 01 '11 at 14:43
  • i've tried it both ways with no love. :( having a bad day hah. – fighella Jun 01 '11 at 14:48
  • So to take this even further... it seems that i can't get one of my rvm profiles to stay as the default profile... so whenever the shell reloads, it resets my instance back to be aimed at the non rvm version of ruby... and for whatever reason this installation doesnt work. – fighella Jun 02 '11 at 08:45
  • Hm, that really sounds bad. Daniel's hint towards fixing the default Ruby seems worth a try. – slhck Jun 02 '11 at 08:49

1 Answers1

1

It looks like you have replaced the default Ruby version with a version of Ruby that doesn't include pathname. on its module search path. Fix your Ruby installation, or point /usr/bin/ruby to the default installation. For me it's the following:

lrwxr-xr-x 1 root wheel 76 30 Jun 2010 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby


To be sure, run the following command and check these directories for a file called pathname.rb:

$ /usr/bin/ruby -e "puts $:"
/Library/Ruby/Site/1.8
/Library/Ruby/Site/1.8/powerpc-darwin10.0
/Library/Ruby/Site/1.8/universal-darwin10.0
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
.

I found pathname.rb in the second group of directories:

find /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby -iname "pathname.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb    
Daniel Beck
  • 109,300
  • 14
  • 287
  • 334
  • `➜ ~ /usr/bin/ruby -e "puts $:"` `/opt/local/lib/ruby/site_ruby/1.8` `/opt/local/lib/ruby/site_ruby/1.8/i686-darwin10` `/opt/local/lib/ruby/site_ruby` `/opt/local/lib/ruby/vendor_ruby/1.8` `/opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin10` `/opt/local/lib/ruby/vendor_ruby` `/opt/local/lib/ruby/1.8` `/opt/local/lib/ruby/1.8/i686-darwin10` – fighella Jun 01 '11 at 14:11
  • it looks like its that refers to macports? is that right... i am trying to NOT use macports any more... – fighella Jun 01 '11 at 14:13
  • 1
    use `ln -s` to replace your `/usr/bin/ruby` link to the default installation. thats why i included the path in my post. – Daniel Beck Jun 01 '11 at 14:22
  • so lets say my "default installation" is fubarred, how would i fix that? – fighella Jun 02 '11 at 05:55
  • @fighella Reinstalling (you can keep user accounts and application, IIRC) or using [Pacifist](http://superuser.com/questions/171433/is-it-possible-to-reinstall-fix-mac-os-xs-system-ruby-without-doing-a-complete-o/227653#227653). – Daniel Beck Jun 02 '11 at 07:49