How to get acts_as_attachement plugin working on mac osx


If you want to use acts as attachement for image upload/manipulation as well then first you need to install imagemagick (and its dependencies) and RMagick.

Before installing imagemagick you also need to install the following libraries as well:

1) libjpeg

Download it from http://www.ijg.org/files/jpegsrc.v6b.tar.gz

tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
cp /usr/share/libtool/config.sub .
cp /usr/share/libtool/config.guess .
./configure --enable-shared --enable-static
make
sudo make install
sudo ranlib /usr/local/lib/libjpeg.a

2) libpng

Download it from http://www.libpng.org

tar zxvf libpng-1.2.22.tar.gz
cd libpng*
./configure
make check
sudo make install
sudo ranlib /usr/local/lib/libpng.a

3) freetype

Download it from http://download.savannah.nongnu.org/releases/freetype/

tar zxvf freetype-2.3.5.tar.gz
cd freetype*
./configure
make
sudo make install

4) libwmf

Download it from http://wvware.sourceforge.net/libwmf.html

tar zxvf libwmf-0.2.8.tar.gz
cd libwmf*
./configure
make check
sudo make install

5) ghostscript

Download it from http://pages.cs.wisc.edu/~ghost/doc/gnu/index.htm

tar zxvf ghostscript-8.01.tar.gz
cd ghostscript*
./configure
make
sudo make install

Imagemagick installation
Download it from http://www.imagemagick.org/script/download.php

tar zxvf Imagemagick-6.3.2.tar.gz

cd Imagemag*
export CPPFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
./configure –prefix=/opt/local –disable-static –with-modules –without-perl \
–without-magick-plus-plus –with-quantum-depth=8 \
–with-gs-font-dir=/opt/local/share/ghostscript/fonts
make
sudo make install

RMagick Installation
If ruby and gem package manager is installed on your machine then simply do
sudo gem install rmagick
To check whether it is installed properly;
– go to terminal and run
irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version

this should give you the following output

This is RMagick 1.15.10 ($Date: 2007/06/09 16:45:25 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.2 10/28/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.6 (2006-12-25 patchlevel 0) [i686-darwin8.9.1]]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org

Installing rmagick from source

tar xvzf RMagick.tar.gz
cd RMagick*
./configure
make
sudo make install

Using Act_as_attachment
I was about to write this but then I found a very good tutorial on installing and using acts_as_attachment here.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s