Showing posts with label os x. Show all posts
Showing posts with label os x. Show all posts

Saturday, December 4, 2010

Installing curb gem on Mac OS X 10.6 (Snow Leopard)

If you have previously installed curl with something like:

    sudo port install curl +ssl

and then try to install the curb gem like:

    sudo gem install curb

and you find yourself getting an error that looks something like this:


In file included from /opt/local/include/curl/curl.h:44,
from curb.h:12,
from curb.c:8:
/opt/local/include/curl/curlrules.h:144: error: size of array ‘__curl_rule_01__’ is negative
/opt/local/include/curl/curlrules.h:154: error: size of array ‘__curl_rule_02__’ is negative
lipo: can't open input file: /var/folders/wX/wX64Cb+PGjG-EXuklO+I+k+++TI/-Tmp-//ccKIrqTY.out (No such file or directory)
make: *** [curb.o] Error 1

Then, I think I have a solution for you. Change your curb install command to this instead:

    sudo env ARCHFLAGS="-Os -arch x86_64 -fno-common" gem install curb

It seems a number of people on the web suggest re-installing curl as a universal binary using something like:

    sudo port install zlib +universal
sudo port upgrade --enforce-variants openssl +universal
sudo port install curl +universal

I do not like this approach. The original problem is that you installed an x86_64 version of curl (which is the default, as it should be) but you are trying to install a universal version of curb (which is unfortunately the default). Instead of re-installing curl to be universal, which is wasteful and takes forever, install curb using the x86_64 flags to build it. This is what you want, it works, and it only takes a few seconds.