开发者

How to install ImageMagick for use with RVM

I had a non-rvm app going and decided to move to RVM. Now I'm noticing pa开发者_如何学运维perclip failing as ImageMagick isn't available.

[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Could not run the `identify` command. Please install ImageMagick.>

What's the right way to get ImageMagick installed on RVM?


On OS X if you have brew installed, you can simply use the following command:

brew install imagemagick


ImageMagick isn't a gem, it's a normal packet. On debian, the package name is imagemagick. You can install it via apt-get install imagemagick as root.


None of the above worked (on Ubuntu 10.10 64 bit)

I had to

sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev libmagickwand-dev 

then

gem install rmagick

(in Rails 3.1)


On ubuntu, but this might also work on MacOS. You def want to compile from source when using ruby. Here the script I use

*install_imagemagick.sh*

#!/bin/bash
mkdir -p ~/local
command -v identify > /dev/null
if [ $? -eq 1 ]; then
    echo "${bldgrn}Installing imagemagick into ${txtwht}$HOME/local/imagemagick${txtrst}"
    wget -N --retr-symlinks ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
    tar -xzvf ImageMagick.tar.gz
    cd ImageMagick-*
    ./configure --prefix=$HOME/local/imagemagick
    make
    make install
    cd ..
    rm -rf ImageMagick-*
fi

Then I add this to my ~/.bashrc or ~/.zshrc

export PATH=$HOME/local/imagemagick/bin:$PATH
export LD_LIBRARY_PATH=$HOME/local/imagemagick/lib:$LD_LIBRARY_PATH

Then you can install your ruby bindings if necessary:

gem install rmagick


For Cygwin, remember to use:

http://www.imagemagick.org/download/binaries/ImageMagick-i686-pc-cygwin.tar.gz

instead of:

http://cygwin.com/packages/ImageMagick/


If you are on Ubuntu, you can install the package using:

apt-get install imagemagick

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜