2013年1月24日木曜日

Homebrewの前にMacTexを入れてしまった

MacにTex環境を整えようと,Homebrewで

$ brew install tex

と打つと,「MacTexを使って入れてね☆(ゝω・)v」と言われます.


そのまま何も考えずに,MacTexのホームページからMacTex.pkgをダウンロード.
pkgからインストーラを起動し,「続ける」を連打した結果.

/usr/local/bin/

にghostscriptやらのフォルダがroot権限で出来上がりました.
(/usr/local/binはHomebrewが管理するファイルが格納される場所)

もちろん,Homebrewの管理下はないため,
几帳面な人にとっては非常に精神衛生上よろしくないことに.


てなわけで綺麗にしていきます。

ghostscript

$ brew install ghostscript

でインストール

最後,リンクがうまくいかないのでやり直してと言われる.

$ brew link --overwrite --dry-run ghostscript

と打つと,MacTexで入れたghostscript関連の競合しているファイルがリストで表示される.

$ brew link --overwrite ghostscript

と打つと,リストのファイルが全て上書きされる.

しかし,まだエラーが

$ brew link --overwrite ghostscript
Linking /usr/local/Cellar/ghostscript/9.06... Warning: Could not link ghostscript. Unlinking...

Error: Could not symlink file: /usr/local/Cellar/ghostscript/9.06/share/ghostscript/Resource
/usr/local/share/ghostscript is not writable. You should change its permissions.

権限を変更しろといわれるので

$ sudo chown -R ユーザ名:admin /usr/local/share/ghostscript

でOK。

その後、

$ brew link ghostscript
とすれば、
Linking /usr/local/Cellar/ghostscript/9.06... 61 symlinks created


となる。

また、
brew doctor
とすると、
Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man/de
    /usr/local/share/man/de/man1

となったので、さっきの要領でこちらも権限を変更する。

$ sudo chown -R ユーザ名:admin /usr/local/share/man

OK。


imagemagick

$ brew install imagemagick
と、打つ。

Warning: Could not link imagemagick. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link imagemagick'

ここでも、リンクが上手くいかないといわれるので解決する。

$ brew link --overwrite --dry-run imagemagick
Would remove:
/usr/local/etc/ImageMagick/type.xml
/usr/local/etc/ImageMagick/type-windows.xml
/usr/local/etc/ImageMagick/type-ghostscript.xml
/usr/local/etc/ImageMagick/type-dejavu.xml
/usr/local/etc/ImageMagick/thresholds.xml
/usr/local/etc/ImageMagick/quantization-table.xml
/usr/local/etc/ImageMagick/policy.xml
/usr/local/etc/ImageMagick/mime.xml
/usr/local/etc/ImageMagick/magic.xml
/usr/local/etc/ImageMagick/log.xml
/usr/local/etc/ImageMagick/delegates.xml
/usr/local/etc/ImageMagick/colors.xml
/usr/local/etc/ImageMagick/coder.xml
/usr/local/bin/convert
/usr/local/share/man/man1/convert.1

こんもり。全部上書きします。

$ brew link --overwrite imagemagick
Linking /usr/local/Cellar/imagemagick/6.8.0-10... Warning: Could not link imagemagick. Unlinking...

Error: Permission denied - /usr/local/etc/ImageMagick/type.xml

権限がないと言われたので、権限を変更、その後再度実行。

$ sudo chown -R inabakengo:admin /usr/local/etc/ImageMagick

$ brew link --overwrite imagemagick
Linking /usr/local/Cellar/imagemagick/6.8.0-10... 71 symlinks created

OK。

MacTex


公式のMacTex.pkgからインストーラを起動。
途中のInstalation Type画面のカスタマイズボタンを押し、
GhostscriptとConvert-IMのチェックを外しておく。

後はそのまま。

インストールが完了したら、TexLive Utilityを起動し、自動アップデートを行う。

更新情報がうまくダウンロードできなかったらリポジトリのURLを変えてみる。
設定→リポジトリを管理→好きなサイトを選択。

その後、「作業→すべてのパッケージを更新」とする。




2 件のコメント:

  1. ああ、MacTexかっ!まさにドンピシャな状況で困ってたので助かりました!!

    返信削除
  2. 僕も全く同じ状況にハマってました!助かりました!

    返信削除