`

在Leopard上手动安装RMagick

阅读更多
这几天刚刚给自己的小白安装了Leopard,开始迫不及待的把开发环境搬到上面去。Leopard已经自带了完整的ruby-1.8.6和rails-1.2.3,我的项目是用rails-1.2.6的,另外还有一些gem要安装,所以二话不说,马上开始。
# 更新gems,从0.9.4到1.0.1
sudo gem update --system
# 安装rails-1.2.6
sudo gem install rails -v 1.2.6
# 安装rails-2.0.2
sudo gem install rails
# 安装其他package
sudo gem install ferret
sudo gem install acts_as_ferret
sudo gem install mongrel

然后就到最重要到rmagick了。本来想通过macports来安装,但是速度实在太慢了,所以干脆自己来。把依赖的package都下载好,编译、安装,最后再sudo gem install rmagick,搞定。贴一段脚本上来,以后可以直接执行这段脚本来安装,省得麻烦。不过安装速度挺慢的,可能是我到小白性能不太好。脚本中用到到下载地址各位同学可以自己去换,比如有新版本或其他mirror更快到时候。
#!/bin/sh

curl -O http://nchc.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.5.tar.gz
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://jaist.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.24.tar.gz
tar xzvf libpng-1.2.24.tar.gz
cd libpng-1.2.24
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://dl.maptools.org/dl/libtiff/tiff-3.8.2.tar.gz
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://jaist.dl.sourceforge.net/sourceforge/wvware/libwmf-0.2.8.4.tar.gz
tar xzvf libwmf-0.2.8.4.tar.gz
cd libwmf-0.2.8.4
make clean
./configure
make
sudo make install
cd ..

curl -O http://www.littlecms.com/lcms-1.17.tar.gz
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
./configure
make
sudo make install
cd ..

curl -O http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs861/ghostscript-8.61.tar.gz
tar zxvf ghostscript-8.61.tar.gz
cd ghostscript-8.61
./configure  --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/current/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

curl -O http://imagemagick.site2nd.org/imagemagick/ImageMagick-6.3.7-10.tar.gz
tar xzvf ImageMagick-6.3.7-10.tar.gz
cd ImageMagick-6.3.7
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..

sudo gem install rmagick


分享到:
评论
1 楼 花花公子 2008-01-17  
不用这么费劲吧,apple下应该也有包管理工具,还有macports和fink呢。
以下来自rmgaick官方文档

引用

http://rmagick.rubyforge.org/install-faq.html#osx
How do I install RMagick on OS X?

You have two choices, a procedure that uses MacPorts and a procedure that does not use MacPorts. Each has advantages and disadvantages.

The procedure that uses MacPorts is easier to maintain because you can just use MacPorts and RubyGems to stay current. However the ImageMagick port may be out-of-date (although it's usually very current).

The procedure that does not use MacPorts is not really designed for maintenance. The only way to upgrade is to reinstall everything. However, some people prefer not to use MacPorts. It's up to you.

   1. If you want to use MacPorts:  Here is an OS X installation HOWTO that explains how to use MacPorts to install the delegate libraries and ImageMagick and use RubyGems to install RMagick. You must install the XCode Tools, the X11 SDK, and X11.app and be familiar with Terminal.app.
   2. If you don't want to use MacPorts:  Here (look for "rmagick-osx-installer") is a Ruby script that installs ImageMagick, the recommended delegates, and RMagick on Mac OS X, building everything from source. This script assumes that you have already installed, or are prepared to install, the XCode Tools, the X11 SDK, and X11.app, and are familiar with Terminal.app. Please read the README.rtf file before running the script.

相关推荐

Global site tag (gtag.js) - Google Analytics