LoginSignup
6
6

More than 5 years have passed since last update.

MacでHomebrewを使わずImagemagickをインストールする方法とpath_helperについて

Last updated at Posted at 2015-01-07

Mac OS X 10.9.3. 最初 gs, imagemagickをHomebrewで入れてconvertを使おうとしたのだが,

convert: no images defined `output.png' @ error/convert.c/ConvertImageCommand/3210.

とかエラーが出ていろいろ苦労していた. そこで

$ brew remove imagemagick

で消した後, 以下のページから.pkgを落として入れることで無事使えるようになった.

ImageMagick installer for Mac OS X

pkgで入れるのちょっと嫌だったんだが, 結果は/opt/ImageMagick/, /opt/Ghostscript/ に入るようで興味を持つ. 説明に/etc/paths.d/がどうこう書いてて, shell開き直すと確かにPATHに反映されてる.

$ cat /etc/paths.d/ImageMagick
/opt/ImageMagick/bin

$ which convert
/opt/ImageMagick/bin/convert

初耳だったので調べてみたところ /etc/pathsはBSD由来の何かっぽい. /etc/profile中で/usr/libexec/path_helperが呼び出されている.

/etc/profile
# ...
if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi
# ...

man path_helper すると,

path_helper(8) BSD System Manager's Manual path_helper(8)

NAME
path_helper -- helper for constructing PATH environment variable

SYNOPSIS
path_helper [-c | -s]

DESCRIPTION
The path_helper utility reads the contents of the files in the directories /etc/paths.d and /etc/manpaths.d and appends their contents to the PATH and MANPATH environ-
ment variables respectively. (The MANPATH environment variable will not be modified unless it is already set in the environment.)

とのことで, 単に/etc/pathsらへんの設定テキストを元にPATH=...をセットしてexportするだけのシロモノらしい

path_helper
$ /usr/libexec/path_helper -s

PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/Ghostscript/bin:/opt/ImageMagick/bin:/usr/texbin:...:/Users/hash/.go/bin"; export PATH;

なるほど.

6
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6