15

I am trying to install a ruby gem, but the installation process is stopped, because:

ld: file not found: /usr/local/lib/libfreetype.6.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I install this library? I checked the /usr/local/lib/ and the library is missing there.

EDIT:

I ran locate libfreetype.6.dylib and got:

/Applications/MAMP/Library/lib/libfreetype.6.dylib
/Applications/VLC.app/Contents/MacOS/lib/libfreetype.6.dylib
/Applications/XAMPP/xamppfiles/lib/libfreetype.6.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib/libfreetype.6.dylib
/Applications/calibre.app/Contents/Frameworks/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/v/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/opt/X11/lib/libfreetype.6.dylib
/usr/local/Cellar/freetype/2.4.10/lib/libfreetype.6.dylib

But why system doen't find the library?

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
user984621
  • 46,344
  • 73
  • 224
  • 412

4 Answers4

15

What library are you trying to install? Could it by chance be ImageMagick? Also, if it's a RubyGem, why is the post tagged with homebrew?

Anyways, I got this error when installing ImageMagick, you need to symlink /opt/X11/lib/libfreetype.6.dylib to /usr/local/lib.

do this:

ln -s /opt/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib

weddingcakes
  • 653
  • 1
  • 7
  • 14
15

If you're using brew, you can:

brew link --overwrite freetype

6

Gabriel F. Engel's answer almost worked for me. I had to do the following change:

brew install freetype
brew link --overwrite freetype
talkol
  • 12,564
  • 11
  • 54
  • 64
3

Your compiler is trying to link to an lib at a location that doesn't have the lib, however it seems that you have installed it with homebrew. Try running ln -s /usr/local/Cellar/freetype/2.4.10/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib to create one, or you can just use the without-freetype flag to skip it.

Sevki
  • 3,592
  • 4
  • 30
  • 53