Installing RMagick gem — Can't find MagickWand.h

前端 未结 9 1210
不知归路
不知归路 2020-12-16 17:19

I am installing the rmagick gem on OSX 10.6.8, using gem install rmagick, and I am getting the following error

    Can\'t install RMagick 2.13.1         


        
9条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 17:47

    Here's a solution for OS X Mavericks - at least it worked for me...

    First, install Xcode 5 (from the App Store)

    Then install development-tools - open Terminal and type:

    xcode-select install
    

    Next, grab the ImageMagick package from CatusLab: http://cactuslab.com/imagemagick/ (I opted for the package without Freetype support, that requires XQuarz - but it's really up to you).

    You'll need pgkconfg as well - get it here: http://macpkg.sourceforge.net

    Once installed, export the pkgconfig binary:

    export PATH=/opt/pkgconfig/bin:$PATH
    

    Then find the MagickWand.h

    mdfind MagickWand.h
    

    it puts out the path to MagickWand.h, in my case /opt/ImageMagick/include/ImageMagick-6/wand/MagickWand.h

    Next find the pkgconfig path:

    mdfind MagickCore.pc
    

    For me it put out: /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

    I had the problem that rmagick gem couldn't be fetched so I downloaded it from rubygems.org/gems/rmagick

    With the rmagick gem downloaded to your Download folder you should now be able to install rmagick:

    sudo C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6/ PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install --local ~/Downloads/rmagick-2.13.2
    

    For me it installed successfully - hope this helps...

提交回复
热议问题