简体   繁体   中英

Rails + Mac OS X: libMagickCore-Q16.7.dylib doesn't work

If I run some kind of rake command, I get this error message:

rake aborted!
dlopen(/Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libfreetype.6.dylib
  Referenced from: /usr/local/lib/libMagickCore-Q16.7.dylib
  Reason: Incompatible library version: libMagickCore-Q16.7.dylib requires version 16.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 - /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle
...

I am running on RoR 3.2, OSX Lion.

Could anyone help me, please, how to fix this issue? I spent 2 days of googling, reading discussions, but unfortunately with zero success...

Thank you so much!

Using Homebrew I was able to solve it using the following commands:

brew uninstall freetype
brew update
brew install freetype

Update step might be unnecessary. The installation succeeded but with the following warning:

Warning: Could not link freetype. Unlinking...

So one final command:

brew link --overwrite freetype

I have an amazing how-to-install-rmagick that have been working beautifully for me, try to re-install ImageMagick following these steps:

  1. yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel -y (I use CentOS, you can translate the commands to your distro)
  2. Download ImageMagick. Write wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz and press Enter. ImageMagick.tar.gz is created in the current directory.
  3. Unpack the ImageMagick archive. Write tar xczf ImageMagick.tar.gz and press Enter. A new directory, ImageMagick-version, where version is the ImageMagick version number, is created.
  4. Switch to the ImageMagick directory. Write cd ImageMagick-version and press Enter.
  5. Configure the ImageMagick build. Write ./configure --prefix=/usr/local --without-perl and press Enter.
  6. Compile ImageMagick. Write make and press Enter. ImageMagick compiles. This step may take several minutes.
  7. Install ImageMagick to your home directory. Write make install and press Enter.
  8. Remove the installation files. Write rm -r ImageMagick.tar.gz and press Enter.
  9. Add /usr/local/bin to your PATH.
    • Write echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile and press Enter.
    • Reload your .bash_profile. Write source ~/.bash_profile and press Enter.
  10. Install the RMagick gem.
    • Write export LD_LIBRARY_PATH=/usr/local/lib and press Enter.
    • Write export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and press Enter.
    • Install the RMagick gem in your Ruby on Rails application.

Tell me later how it goes.

Do you use something like Homebrew or MacPorts to manage external library dependencies?

Installing the imagemagick library from there and then install rmagick.

I found the answer in another post:

Rails 3 - RMagick doesn't find libfreetype.6.dylib using Paperclip

I performed the search and found that there was an older version of libfreetype that was being referenced and newer versions hidden elsewhere. By copying/linking the newer versions into the appropriate directory (/usr/local/lib in my case) the problem was resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM