matthew as a q.

競技プログラミングメイン

MacPortsでTeXインストールでのエラー

環境:OSX Lion。以前、一度何らかのTeX環境を作ったことがあるという状況。

エラー

sudo port install texlive-lang-cjk texlive-documentation-japanese

を実行してインストールしようとした。

Error: org.macports.activate for port texlive-bin returned: Image error: /opt/local/include/kpathsea/absolute.h is being used by the active pTeX port.  Please deactivate this port first, or use 'port -f activate texlive-bin' to force the activation.

とのエラーが出た。意味合いとしては、「texlive-binの使いたいものがpTeXに使われているから、pTeXを無効化するか、さもなくば、

sudo port -f activate texlive-bin

を打ち込んで、texlive-binのほうを無理やり有効にしてください」とのこと。

解決策

前者のpTeX

sudo port deactivate pTeX

で無効化したのち、再び

sudo port install texlive-lang-cjk texlive-documentation-japanese

を実行するとうまく導入できた。

実際使うときは

platex test.tex

でdviファイル作成、

xdvi text.dvi

でチェック(なぜかうまく表示されなかった)、

dvipdfmx text.dvi

でpdfの作成ができた。

蛇足

はじめは上記のエラーのあと、後者の「texlive-bin」等を有効化する方法で行なっていた。しかし、以下のエラーにぶつかった。

Error: Unable to open port: couldn't change working directory to "/opt/local/var/macports/sources/rsync.macports.org/release/ports/net/curl-ca-bundle": no such file or directory

Error: Unable to execute port: upgrade texlive-bin failed

curl-ca-bundle」がないようなので、その入れ方等とぐぐってみた。すると出てくるのは、Homebrewのエラーへの対処法(「/opt/local/share/curl/」下に「curl-ca-bundle.crt」という証明書を作成する等)ばかりだった。この証明書を、エラーメッセージのディレクトリにおいてみたりしたがダメだった。エラーメッセージのディレクトリにcurl-ca-bundleはなかったが、curlディレクトリがあったので、名前変更

mv curl curl-ca-bundle

したりしてみたが、そうすると今度は、curlディレクトリないよ!とのエラーが出たので、なんらかの要因で別の名前が付いていたわけではないことがわかった。名前はもとに戻しておいた。

その後、

sudo  port selfupdate

sudo port update outdated

してみたりした後、ある記事を見て「deactivateコマンド!そういうのもあるのか」と知り、解決に至った。半日くらいもにょってた。