【Mountain Lion】動かなくなったImageMagickをMacに再びインストールする方法。

前回の続き。
弊社のエンジニアである片岡氏に手伝ってもらって、テストサーバー用のsqlファイルをDBに読ませたところまでいきました。

しかし残念なことに、画像を用いるページで「ImageMagickが無い」と怒られました。

 

やりたいこと:PHPからImageMagickを操作するための Imagickモジュールを入れたい。

Lionの時には、ほとんど他人にやってもらった開発環境のセットアップで”ImageMagick”をインストールしたっけ…なんて思いつつ調べていたら、Mountain Lionにアップデートすると昔の開発環境とともに使えなくなるケースがあるみたいですね。

(参考)→  Mountain Lionで動かなくなったimagickの復活方法

ここがすごく丁寧にかかれているんですが、パッケージ管理ツールのHomebrewでImageMagickのインストールに入ろうとすると、パッケージの管理データが古いのかソースがうまくダウンロードできず、しまいにはgccが無いよと怒られて面倒くさくなってしまったので、別のパッケージ管理ツールである「MacPorts」でやっちゃいました。こちらは何のストレスもなくスムーズにいきました。

手順

1.Macportsをダウンロードしてインストールする
Macportsの公式サイト  からMountainLion用の .pkgファイルをダウンロードして、GUIベースでMacportsインストールを終える。

 

2.環境変数にパスを追加して、Macportsをアップデートする

//bash_profileにパスを追加

$ vim ~/.bash_profile

//以下2行を追加

export PATH=/opt/local/bin:/opt/local/sbin/:$PATH
export MANPATH=/opt/local/man:$MANPATH

//セルフアップデート

$ sudo port -d selfupdate

(参考)→ MacにImageMagickをインストールする方法

 

3.Macportsを使って、ImageMagickのインストールする

//ImageMagickのインストール(20~30分程度)

$ sudo port install ImageMagick

4.PHP/Imagickを入れる

僕の環境だとPECLコマンドがなぜか使えなかったので、Imagickのソースを直接ダウンロードしてモジュールにコンパイルしました。

//ダウンロード

$ curl -O http://pecl.php.net/get/imagick-2.2.1.tgz

//解凍

$ tar zxvf imagick-2.2.1.tgz

//モジュールのコンパイル

$ cd imagick-2.2.1

$ phpize

$ ./configure –with-imagick=/opt/local

$ make

$ sudo make install

//モジュールのコピー

$ sudo cp modules/imagick.so /usr/lib/php/extensions/no-debug-non-zts-20060613/

(参考)→ MacにPHP/Imagickをインストールする, OSX に PECL::imagick をインストール

5.php.iniにモジュールの読み込み設定を書き込み、Apacheの再起動

$ sudo vim /private/etc/php.ini

//適当なところに追加

extension=imagick.so

//Apache再起動

$ sudo apachectl restart

 

これで無事に、MountainLionの開発環境(PHP)上でImageMagickが動くようになりました!仕組みがわかってくると黒い窓への恐怖感も緩和してくるものですね。macportsの環境変数の追加だったり、モジュールのコピー先がApacheのExtensionsをちゃんと指してるかどうかなどがよく行き詰るところだと思われます!

 

← Previous post

Next post →

59 Comments

  1. おはようございます。 ぎょうじゃきも帰りも ナイチンゲール。レッスンのろくおん聞きながらおべんきょうの3じかん。レッスンのときにはイマイチ理解できなかったけれどなんでも回もなんでも回も聞いて や~っと そういうことかととりあえず、まずいちつ 気がついた。ナイチンゲールはAでなかず。pのA と、fのAと、ffのAの 3しゅたぐいのA。この3しゅのAがおなじでないおとほどでないといけないらしい。そのためのしたのコントローラーらしい。ばぁちゃんのおけいこごとは解りが遅い。 ヒマがかかる!まして、おとほどかんけいづける!? はなんしい。けどまぁ. . そういうこともある! [url=http://burgmancat.com/foro/Cloe.php]クロエ 財布 人気[/url]
    九州ツーリングをさらに楽しんでいただくことができます。  しょぎょうむじょうのひびくあり
    [url=http://burgmancat.com/foro/Celine.php]セリーヌ バッグ 新作 2013[/url] しかしながら、チームのほきょうポイントはこのポジションではない。 いま日はくもるから でも すすきいから日が見えそうだな ここ最近 あさから暑かったがちょうどよくかぜが吹き いま日はすずしくなるな このてん候が続けばよくが
    [url=http://www.toyohirakumap.com/company/prada.html]プラダ 新作[/url]

  2. Business enterprise coaching reveals enterprise owners ways to use effective organization fundamentals to enhance the direction of the company and meet the desires with the business enterprise owner. There are 40’000 most people within the US that supply enterprise coach education plus the want to get a Enterprise Coach is rising just about every year. It is regarded one of several fastest expanding industries on the planet.

  3. I’ve virtually no conditions. These kind of dcuo cash final forever. It’s not necessary to be able to kepp purchasing brand new ones each and every year for a more affordable make. They can cover theirselves. They are todaly durable and definately will final within the snowfall so long as normal water proofed.

  4. Exactly why noone is speaking about watch and something that one ought to take care of straight away.

  5. 3gyaWc Tremendous issues here. I am very glad to see your article. Thank you so much and I am looking forward to contact you. Will you please drop me a mail?

  6. “I have read a few good stuff here. Certainly worth bookmarking for revisiting. I wonder how a lot effort you set to create this type of fantastic informative web site.”

  7. Pretty! This was an incredibly wonderful article. Many thanks for providing these details.

  8. Thanks a lot for the article post.Thanks Again. Will read on…

  9. I think this is a real great blog article.Much thanks again. Fantastic.

  10. This particular blog is without a doubt educating as well as amusing. I have found many handy stuff out of this source. I ad love to go back again and again. Thanks!

  11. This unique blog is no doubt educating and also factual. I have picked many interesting things out of this amazing blog. I ad love to return every once in a while. Thanks a bunch!

  12. You have brought up a very fantastic points , regards for the post.

  13. Normally I really do not study post on blogs, but I must say until this write-up really forced me to try and do thus! Your creating style continues to be amazed us. Thanks, very wonderful post.

  14. Muchos Gracias for your article.Thanks Again. Fantastic.

  15. Really appreciate you sharing this article.Much thanks again. Fantastic.

  16. Im grateful for the post.Thanks Again. Cool.

  17. Hey, thanks for the blog article.Really looking forward to read more. Keep writing.

  18. Major thankies for the blog.Really thank you! Awesome.

  19. Way cool! Some very valid points! I appreciate you penning this post and also the rest of the site is also very good.

  20. Enjoyed every bit of your blog.Much thanks again. Will read on…

  21. This is one awesome post. Fantastic.

  22. Fantastic post.Really looking forward to read more. Great.

  23. Very good article.Really looking forward to read more. Keep writing.

  24. I simply want to tell you that I am new to blogging and site-building and certainly enjoyed your page. More than likely I’m planning to bookmark your site . You actually have terrific well written articles. Thanks for sharing with us your web site.

  25. I truly appreciate this article post.Thanks Again. Will read on…

  26. I value the blog post.Really looking forward to read more. Much obliged.

  27. Great, thanks for sharing this post. Really Cool.

  28. Some really good blog posts on this website , regards for contribution.

  29. Very informative blog article.Really thank you! Fantastic.

  30. Wow! This could be one particular of the most helpful blogs We ave ever arrive across on this subject. Actually Magnificent. I am also a specialist in this topic so I can understand your effort.

  31. Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is great, let alone the content!

  32. Hey, thanks for the blog article.Really thank you!

  33. LOUIS VUITTON PAS CHER ??????30????????????????5??????????????? | ????????

  34. I truly appreciate this article post.Much thanks again. Cool.

  35. Great, thanks for sharing this article post.Really thank you! Great.

  36. It is really a nice and helpful piece of information. I am glad that you shared this useful information with us. Please keep us informed like this. Thanks for sharing.

  37. Say, you got a nice blog article. Will read on…

  38. Great, thanks for sharing this blog.Thanks Again. Great.

  39. Wow, what a video it is! Actually nice quality video, the lesson given in this video is actually informative.

  40. Wow, superb blog structure! How lengthy have you ever been running a blog for? you make blogging look easy. The total glance of your website is great, let alone the content material!

  41. It is not my first time to visit this web site, i am visiting this site dailly and take pleasant information from here daily.

  42. Very good blog article.Thanks Again. Great.

  43. Thanks for sharing amazing Article.

  44. I am so grateful for your blog.Thanks Again. Really Great.

  45. I appreciate you sharing this post. Much obliged.

  46. I really enjoy the blog article.Thanks Again. Awesome.

  47. PleasаА аЂа• let mаА аЂа• know аАаб‚Т€Т“f thаАаб‚Т€Т“s ok ?ith аАааБТ“ou.

  48. This is one awesome article post.Really thank you! Really Cool.

  49. whoah this weblog is great i really like studying your articles. Stay up the great work! You already know, lots of persons are looking round for this information, you can aid them greatly.

  50. Thank for the article. Worth reading

  51. 9BrGkk I’а†ve recently started a blog, the info you offer on this site has helped me greatly. Thanks for all of your time & work.

  52. Thanks again for the article post.Really thank you! Keep writing.

  53. Thank you for your article post. Really Cool.

  54. Thanks for this amaing article.

  55. I really like and appreciate your article post.Really looking forward to read more. Awesome.

  56. LYFHmx Major thankies for the article. Awesome.

コメントを残す