Image Image Image Image Image Image Image Image Image

Installing mysql2 gem on Mac OSX

April 14, 2014 | By | No Comments

Just spent 20 mins trying to install the mysql2 gem on my Mac OSX dev machine. Here’s the solution for anyone else who’s stuck with the same problem.

The gem requires the mysql client library (libmysqlclient) which it wasn’t able to find. Apparently, the client library is provided by the mysql-unified-dev fink package [1] which was broken (failing with a compilation error) [2]

So, I downloaded the MySQL Mac OSX tarball, extracted it into/usr/local/mysql, and installed the gem. And voila! It worked!

$ gem install -v 0.3.11 mysql2

[1] I prefer fink over homebrew

[2] Error message:

gcc -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -I/usr/local/fink/include -DDBUG_OFF -Wimplicit -Wreturn-type -Wswitch -Wtrigraphs -Wcomment -W -Wchar-subscripts -Wformat -Wparentheses -Wsign-compare -Wwrite-strings -Wunused -O3 -fno-omit-frame-pointer -g -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -c longlong2str_asm.c longlong2str_asm.c:29:7: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] char *longlong2str(longlong val,char *dst,int radix) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/m_string.h:240:38: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ~^ longlong2str_asm.c:29:20: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:29:7: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] char *longlong2str(longlong val,char *dst,int radix) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/m_string.h:240:42: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ~^ longlong2str_asm.c:29:33: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:29:7: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] char *longlong2str(longlong val,char *dst,int radix) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/m_string.h:240:46: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ~^ longlong2str_asm.c:29:43: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:29:7: error: expected parameter declarator char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:49: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ longlong2str_asm.c:29:7: error: expected ')' longlong2str_asm.c:29:7: note: to match this '(' char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:36: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ longlong2str_asm.c:29:7: error: conflicting types for 'int2str' char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:29: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ ../include/m_string.h:234:14: note: previous declaration is here extern char *int2str(long val, char *dst, int radix, int upcase); ^ longlong2str_asm.c:29:7: error: parameter name omitted char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:38: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ longlong2str_asm.c:29:20: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:29:7: error: parameter name omitted char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:42: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ longlong2str_asm.c:29:33: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:29:7: error: parameter name omitted char *longlong2str(longlong val,char *dst,int radix) ^ ../include/m_string.h:240:46: note: instantiated from: #define longlong2str(A,B,C) int2str((A),(B),(C),1) ^ longlong2str_asm.c:29:43: note: instantiated from: char *longlong2str(longlong val,char *dst,int radix) ^ longlong2str_asm.c:31:39: error: use of undeclared identifier 'val' return longlong2str_with_dig_vector(val, dst, radix, _dig_vec_upper); ^ 3 warnings and 7 errors generated. make[2]: *** [longlong2str_asm.o] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 ### execution of make failed, exit code 2 ### execution of /tmp/fink.o46y_ failed, exit code 2 Removing runtime build-lock... Removing build-lock package... /usr/local/fink/bin/dpkg-lockwait -r fink-buildlock-mysql-unified-5.0.96-1 (Reading database ... 65817 files and directories currently installed.) Removing fink-buildlock-mysql-unified-5.0.96-1 ... Failed: phase compiling: mysql-unified-5.0.96-1 failed

Submit a Comment