Re:VIEW環境構築で詰まったことと解決策

技術書典のためにRe:VIEWの環境構築

技術書典6に出す同人誌を書くためにMacでRe:VIEWの環境構築を行ったのですが、ハマったところが幾つかあったので共有します。

Gemディレクトリのパーミッションエラー

$ brew install ghostscript
$ brew install cask mactex
$ gem install review
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

Mac標準で使っているRubyの関係でGemがインストールできませんでした。rbenvでユーザー権限でRubyの環境構築しました。

$ brew install rbenv ruby-build
$ rbenv install 2.6.0
$ rbenv global 2.6.0

.zshrcまたは.bashrcに以下を追記しました。

[[ -d ~/.rbenv  ]] && \
  export PATH=${HOME}/.rbenv/bin:${PATH} && \
  eval "$(rbenv init -)"

MacTexの問題

Re:VIEWのLaTeX関連でMacTexをインストールしていたのですが、extractbbが実行できなくなっていました。

No such file or directory - extractbb

tlmgrコマンドも実行できません。

$ sudo tlmgr update --self --all
sudo: tlmgr: command not found

tlmgrのパスを追加しようとしたのですがディレクトリが既に存在してシンボリックリンクが作成できないと出ました。

$ sudo /usr/local/texlive/2018/bin/x86_64-darwin/tlmgr path add
add_link_dir_dir: /usr/local/share/info/dir exists; not making symlink.

ひとまず/usr/local/share/info/dirを削除。これでMacTex(Tex Live)も正常に動くようになりました。

$ rm /usr/local/share/info/dir
$ sudo /usr/local/texlive/2018/bin/x86_64-darwin/tlmgr path add
$ sudo tlmgr update --self --all

`spawn’: No such file or directory – uplatex

2021年になってRe:VIEWを使っていたら再びrake pdfでエラーが発生しました。

`spawn': No such file or directory - uplatex

シンボリックリンクを張り直すことで解決しました。

$ sudo ln -s /usr/local/texlive/2021/bin/universal-darwin/ /Library/TeX/texbin