TeX 2017 から 2019 へ (MacOS Mojave)
これまで BasicTeX 2017 を使っていたので、なるべく既存のものを残しつつ 2019 にアップデートしていきます。当然、TeX Live 2017 のリポジトリは freeze されているので、普通の sudo tlmgr udpate --self --all
はできません。
公式ページ (https://tug.org/texlive/upgrade.html) に update の方法が載っているのを発見したので、それにしたがって update していきます。また、この ブログ もとても参考にさせていただきました。個人的な備忘録も兼ねて、公式の手順の後ろに私の環境で何をしたか・何が起きたかを書いておきます。
目次:
アップデート
Step 1
- Find the parent directory of the current installation; it's
/usr/local/texlive
by default.
私の環境では基本的に BasicTeX だけを入れてあるので、 /usr/local/texlive/2017basic/
というディレクトリがあるようです。
Step 2
- Copy the whole directory
2018
to2019
, preserving symbolic links; for example:cp -a 2018 2019
. If you don't understand this, stop here and do a regular installation.
2018
フォルダはないので、とりあえず 2017basic/
を2019basic/
にコピーします。シンボリックリンクのためにも cp -a
オプションをつけておきます。次の手順でも言われているように、万が一のとき戻れるように前のバージョンのフォルダを残しておくのも大事です。もしこれ以降のどこかで詰まったら普通に全消ししてクリーンインストールしようという気持ちで進んでいきます。
Step 3
- To save some space, you can exclude
tlpkg/backups/*
or remove them from the2019/
directory afterwards. (Theoretically, you could rename2018
to2019
, but we strongly advise against this, since you may lose your existing installation with no good way back.)
素直に従って rm -rf tlpkg/backups/*
します。
Step 4
- If you installed symlinks in system directories (via the installer option or
tlmgr path add
), remove them now withtlmgr path remove
.
これまで tlmgr path add
をした記憶はあまりないのですが、一応 remove しておきます。(何も起きませんでした)
Step 5, 6
As needed, adjust your
PATH
in your startup files to point to.../2019/bin/*platform*/
instead of.../2018/...
.Log out and log in, and confirm that your
PATH
now has the2019
directory. This is crucial. Your PATH must use the new location.
手順5で言われているような platform というものは、私の環境では x86_64-darwin
のことを指しているようです。とりあえず、まずは PATH に登録されているものを確認します。確かに登録されています。
$ echo $PATH | tr ':' '\n' ... /usr/local/texlive/2017basic/bin/x86_64-darwin
一応念のため、環境変数で tex という文字列を含むものを検索してみます。私の結果では PWD
と OLDPWD
と PATH
でヒットしました。
$ export -p | grep -i tex
しかしこの中で重要な環境変数はどうやら PATH
らしいので、それの更新を行います。作業をしていて気がついたのですが、PATH
は「どのディレクトリに TeX をインストールしますか」というのを定めているっぽいので、この手順は大事なようです。
$ export PATH=/usr/local/texlive/2019basic/bin/x86_64-darwin:$PATH
再度確認すると、ちゃんと登録されています。
$ echo $PATH | tr ':' '\n' /usr/local/texlive/2019basic/bin/x86_64-darwin ...
Step 7, 8
cd to your top-level
.../2019
directory.Download the latest
update-tlmgr-latest.sh
and run it like this:sh update-tlmgr-latest.sh -- --upgrade
(The extra options are to try to prevent the upgrade from happening unintentionally.)
まずは、tlmgr
コマンドそのものをアップデートしていきます。必要に応じて sudo
をつけます。
$ wget http://mirror.ctan.org/systems/texlive/tlnet/update-tlmgr-latest.sh $ sh update-tlmgr-latest.sh -- --upgrade
Step 9
- If you don't want to use the default repository (that is, not the automatic CTAN redirection) for downloading the new files, run (as usual):
tlmgr option repository *yourrepo*
この手順では、「tlmgr コマンドが、どのオンラインリポジトリからファイルをとってくるか」を設定します。自分に一番近いミラーサイトを知るために、ブラウザで http://mirror.ctan.org/systems/texlive/tlnet
にアクセスしてみます。私の場合は JAIST か山形大のウェブサイトに飛んでいくようなので、リダイレクトしたページのリンクをコピーして、下のコマンドを実行します。
$ tlmgr option repository http://ftp.yz.yamagata-u.ac.jp/pub/CTAN/systems/texlive/tlnet/
ここまできたところで、tlmgr がちゃんと動きそうかを確認します。下のように全て 2019 っぽい感じに表示されれば OK です。tlmgr using installation
の部分は、ローカル環境のインストール先を示しているらしく、PATH
の内容がここに反映されるようです。
$ tlmgr version tlmgr revision 51555 (2019-07-05 00:23:27 +0200) tlmgr using installation: /usr/local/texlive/2019basic TeX Live (http://tug.org/texlive) version 2019
Step 10
- Run (with patience, it will be downloading all the new material):
tlmgr update --self --all
おなじみの sudo tlmgr update --self --all
をします。私の環境では 199 個の変更が起きました。
Step 11, 12
Remake the lualatex/fontspec cache:
luaotfload-tool -fu
If you want symlinks in system directories (not recommended), run
tlmgr path add
.
LuaTeX は使っていないのですが、一応手順11に従っておきます。手順12はスキップしました。
When you are happy with how the new TL is working, if you wish you can remove the old installation by running
.../2018/.../tlmgr uninstall
(full tlmgr doc). Not recommended, since you might always find a document that doesn't work with the new version, just at the wrong time…Good luck, and to reiterate from the top, don't do any of this if it doesn't make sense to you. Just do a fresh installation.
テスト
ここで pdflatex
や uplatex
のテストをしたところ、fmt
ファイルが違うよと怒られます。
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019) (preloaded format=pdflatex) restricted \write18 enabled. ---! /usr/local/texlive/2019basic/texmf-var/web2c/pdftex/pdflatex.fmt made by different executable version (Fatal format file error; I'm stymied)
このサイト によると、いくつかのバイナリが現行の TeX Live と違うのでビルドできないよ、ということらしいです。そこで下のコマンドを実行します。
$ fmtutil-sys --all
これで一応通るようになりました。
蛇足
よく見ると、先ほどのエラーでは、\write18
というものが enabled になっているぞという warning も出ています。What does “restricted \write18 enabled” mean and why does TexLive keep reporting it? によれば write18 は結構気をつけたいものだったのですね……