Joey Pearlman
Joey Pearlman

Reputation: 41

Cannot install Ruby 1.9.3 on Mountain Lion w/ RVM: Error running make

I'm trying to install Ruby so I can do the "Learn Ruby the Hard Way" course, and I've just been having tons of trouble installing the newest version of Ruby

Here's the relevant part of my log:

compiling md5ossl.c
linking shared-object digest/md5.bundle
ld: in /usr/local/lib/libz.1.dylib, file was built for unsupported file format ( 0xce 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 0 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (x86_64): /usr/local/lib/libz.1.dylib for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [../../../.ext/x86_64-darwin12.1.0/digest/md5.bundle] Error 1
make[1]: *** [ext/digest/md5/all] Error 2
make: *** [build-ext] Error 2

I googled around and found this post looking like the exact same problem: Cannot install Ruby 1.9.3 on Mountain Lion w/ Jewlery Box: Error running make -j4 (have current readline, gcc)

But the answer there is an ambiguous "update libz lib". I don't know what that means, I googled around and found zlib but I don't know if these are the same thing as libz? I also found another post indicating libz is libtool, my libtool version is Apple Inc. version cctools-829, but is libtool the same thing as libz? I've never seen any of these terms before or used Ruby before and am just totally confused.

I have gcc 4.2.1 and xcode 4.4.1. Thanks for any help, this is my first post on here so please kindly let me know if I did anything incorrectly or need to provide more information. I basically stole my title from the title I linked to because I wasn't sure about how to format titles, I hope that's okay.

Upvotes: 4

Views: 1048

Answers (1)

tadman
tadman

Reputation: 211720

As a note, OS X does not put anything in /usr/local/lib or /usr/local/bin so you must've installed something there yourself, perhaps even inadvertently.

If you're using a Ruby manager like rvm or rbenv then they have special build tools to help with this process. It's a lot easier than installing from source since the correct patches are applied not only to Ruby but the dependencies like libz.

What you might have is libraries compiled for the wrong architecture on your machine. These may have been rolled over from an old PowerPC install or even Intel 32-bit one from a version of OS X prior to 10.5.

Your best bet might be to simply remove /usr/local/lib/libz* and use the ones that come bundled with your OS instead. You should have a set of the required files in /usr/lib/libz* that can work.

Upvotes: 1

Related Questions