LoginSignup
6
4

More than 5 years have passed since last update.

direnvの"direnv: ([direnv export zsh]) is taking a while to execute. Use CTRL-C to give up."エラーに関して

Last updated at Posted at 2017-09-29

現象

mac mini(late 2012)をmacOS High Sierraにアップデートしたところ、direnvの読み込みで下記のようなエラーが出力されるようになりました。

Last login: Sat Sep 30 03:51:12 on ttys000
direnv: ([direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
direnv: ([/usr/local/Cellar/direnv/2.7.0/bin/direnv stdlib]) is taking a while to execute. Use CTRL-C to give up.
direnv: loading .envrc
direnv: ([/usr/local/Cellar/direnv/2.7.0/bin/direnv dump]) is taking a while to execute. Use CTRL-C to give up.
direnv: export +SOME_ENV
$ 
direnv: ([direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.
$ 

このdirenvをzshのコマンドをhookするように設定していた場合、

direnv: ([direnv export zsh]) is taking a while to execute. Use CTRL-C to give up.

上記のエラー文が毎度出て非常に邪魔です。この原因と対処をまとめておきます。

原因

この問題はGithub上のISSUEでも議論されており、direnv実行時の処理タイムアウトに関するオプションを指定することでこの問題を解決した模様です。
この変更はversion 2.12.0以降に反映されています。

対処

direnvのバージョンを上げましょう。
macOSを使用している場合は brew コマンドでアップデートを行います。

$ brew upgrade direnv                                                    ```

macOSのアップデートを行った場合、Xcodeのバージョンを上げないと brew upgrade が実行できないため、併せてアップデートを実施しましょう。

$ direnv version 
2.13.1

その後シェルを再起動します。以上でエラー文は出力されなくなります。
もしこれでも出力されるようでしたら下記のオプションを .zshrcなどに設定してタイムアウト時間を延長させましょう。

export DIRENV_WARN_TIMEOUT=100s
6
4
0

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
4