Ruby on Rails/Getting Started/Install on OS X/RMagic Installation Shell Script

From Wikibooks, open books for an open world
Jump to navigation Jump to search
# Just put this shell script in the home directory
# it will create a folder called "delete_this_later"
# and put all the sources in it
# once you're done, you can safely delete it as everything
# gets installed under '/usr/local' 


sudo gem uninstall rmagick

dir=delete_this_later

cd
mkdir $dir
cd ~/$dir

echo installing freetype
curl -O http://download.savannah.gnu.org/releases/freetype/freetype-2.1.10.tar.gz
tar xzvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local
make
sudo make install
cd ~/$dir

echo installing libpng
curl -O http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.10.tar.bz2
bzip2 -dc libpng-1.2.10.tar.bz2 | tar xv
cd libpng-1.2.10
./configure --prefix=/usr/local
make
sudo make install
cd ~/$dir

echo installing jpeg
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.4
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ~/$dir

echo installing tiff
curl -O ftp://ftp.remotesensing.org/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 ~/$dir

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 ~/$dir

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

echo installing imagemagick
curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.2.9-8.tar.gz
tar xzvf ImageMagick-6.2.9-8.tar.gz
cd ImageMagick-6.2.9
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 ~/$dir

echo now for rmagick!
curl -O http://rubyforge.rubyuser.de/rmagick/RMagick-1.14.0.tar.gz
tar xvzf RMagick-1.14.0.tar.gz
cd RMagick-1.14.0
make clean
./configure
make
sudo make install
cd ~/$dir

echo "#################################################"
echo hope you got through this alive!
echo
echo be sure to edit .bash_profile or whatver for shell and put /usr/local at the forefront
echo
echo
echo this is mine:
echo export PATH=/usr/local/bin/src:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH
echo
echo
echo now start irb and type:
echo require "'"RMagick"'"
echo
echo if it loads without issue, you should be good to go
echo
echo
echo if you have a botched darwinports or fink attempt for ImageMagick
echo you might want to just delete those unless you have other important packages in there
echo just run:
echo sudo rm -rf /sw
echo sudo rm -rf /opt
echo
echo
echo all credit and thanks to hivelogic and other FAQs for the tutorials
echo where much if not all this material comes from