Install imagick on OS X
I have now installed imagick on 3 machines running Apple OS X Lion and have put these instructions together to help others. There isn’t a great deal of information out there, well not a lot that seems to work or is complete. So here goes.
The 3 machines I used are an iMac 27″, a MBP and a Mac Mini all running OS X Lion with MAMP 2.0.5 and Xcode 4.2 installed
You are going to need the following software.
- Macports dmg http://www.macports.org/install.php
- Latest version of PHP (At this time it is php5.3.10) http://www.php.net
- Apple Xcode v4 or above
If you have any problems please drop me a comment and I will do what I can to help out.
Now, on with the process. This is not a quick one so make sure you have time to do it and that your MBP (if using one) is mains powered.
1. Install Macports, that you have downloaded by running the dmg and installing via the pkg.
2. Open terminal and run
sudo port install ImageMagick
3. Once this is complete run the following,
vi /Applications/MAMP/Library/bin/envvars
4. Comment out the following lines:
- # DYLD_LIBRARY_PATH = “/Applications/MAMP/Library/lib: $DYLD_LIBRARY_PATH”
- # Export DYLD_LIBRARY_PATH
5. Add this at the end
export PATH="$PATH :/opt/local/bin"
6. Now create the directy to add the latest php version to.
mkdir /Applications/MAMP/bin/php/php5.3.6/include
7. And change the permissions
sudo chmod -R 775 /Applications/MAMP/bin/php/php5.3.6/include/
8. Download the php source code of the latest stable version of PHP 5 from php.net if you haven’t already.
9. Navigate to the include folder you have just created
cd /Applications/MAMP/bin/php/php5.3.6/include/
10. Navigate in to the include folder
11. Un tar the php file
tar -xvf /path/to/php-5.3.10.tar.gz
12. Rename the file
mv php-5.3.10 php
13. And navigate in to it
cd php
14 Run the following to configure php
./configure
15. Rename the current pear configuration file
mv /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf.original
16. Install imagick
sudo pecl install imagick
17. When asked for it type the imagickdirectory
/opt/local
18. Add the following to the php.5.3.6 php.ini file via MAMP template editor
extension = imagick.so
19. Navigate to the extensions folder to check if the imagick.so is there.
cd /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
If its not there then it needs to be copied from the location where it has installed. In my experience this could be in /opt/local or /usr/lib/php/extensions. Either way copy it over to the extensions folder in MAMP
cp /location/of/imagick.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/.
You may also need to change the permissions on the recently copied file.
chmod 777 imagick.so
Restart MAMP. Done!
Issues:
As I mentioned I had some issues when doing this, one has been covered off the other one was related to macports not working. At step 2 I received sudo: port: command not found. To overcome this you need to add the following to ~/.bash_history
export PATH=$PATH:/opt/local/bin export MANPATH=$MANPATH:/opt/local/share/man export INFOPATH=$INFOPATH:/opt/local/share/info
Now resource the .bash_profile
source .bash_profile
Trackbacks/Pingbacks
[...] posted here: Install imagick on OS X | technical musings Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers [...]