Cannot install couchbase gem on Mac (OSX 10.12)

Hi there,

Despite libcouchbase being properly installed via Homebrew:

brew install libcouchbase --universal
Warning: libcouchbase-2.7.3 already installed

I keep running into the same error:

sudo gem install couchbase                                                   
Building native extensions.  This could take a while...
ERROR:  Error installing couchbase:
	ERROR: Failed to build gem native extension.
    current directory: /Library/Ruby/Gems/2.0.0/gems/couchbase-1.3.15/ext/couchbase_ext
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20170401-31238-19lf42h.rb extconf.rb
checking for lcb_iops_wire_bsd_impl2(NULL, 0) in -lcouchbase... no

* You must install libcouchbase >= 2.4.5
* See for more details

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:

To see why this extension failed to compile, please check the mkmf.log which can be found here:


extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/couchbase-1.3.15 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/couchbase-1.3.15/gem_make.out

My mkmf.log is as follow:

"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin16 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -I/usr/local/opt/libcouchbase/include -I/usr/local/include -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include -I/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS  -std=c99 -Wall -Wextra  -O2 conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L/usr/local/opt/libcouchbase/lib -L/usr/local/lib -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L/usr/lib -L. -L/usr/local/lib    -arch i386 -arch x86_64   -lruby.2.0.0 -lcouchbase  -lpthread -ldl -lobjc  "
conftest.c:8:27: warning: unused parameter 'argv' [-Wunused-parameter]
int main(int argc, char **argv)
1 warning generated.
ld: warning: ignoring file /usr/local/opt/libcouchbase/lib/libcouchbase.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/opt/libcouchbase/lib/libcouchbase.dylib
Undefined symbols for architecture i386:
  "_lcb_iops_wire_bsd_impl2", referenced from:
      _t in conftest-c8edbb.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 3: #include <libcouchbase/couchbase.h>
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { lcb_iops_wire_bsd_impl2(NULL, 0); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
14:   return 0;
15: }
/* end */

Thank you for any help you can provide :slight_smile:


what ruby version do you use? the built-in ruby might be broken, could you try with ruby from homebrew?

ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

This is Ruby from homebrew

If it is located at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby, then it is not ruby from homebrew.

And btw 2.0.0 does not receive any patches (including security) more than a year already