起こったこと
Gemfile にgem 追加して、bundle install でインストールしてたら、
Rails コマンドでエラー(Permission denied) がでる
$ rails
/usr/local/bin/rbenv-communal-gem-home: line 21: /usr/local/bin/../version_cache/2.6.3: Permission denied
$ rails
Failed loading /usr/local/Cellar/php/7.3.3/pecl/20180731/xdebug.so: dlopen(/usr/local/Cellar/php/7.3.3/pecl/20180731/xdebug.so, 9): image not found
PHP Warning: PHP Startup: Unable to load dynamic library 'imap' (tried: /usr/local/lib/php/pecl/20180731/imap (dlopen(/usr/local/lib/php/pecl/20180731/imap, 9): image not found), /usr/local/lib/php/pecl/20180731/imap.so (dlopen(/usr/local/lib/php/pecl/20180731/imap.so, 9): image not found)) in Unknown on line 0
usage: dirname path
mkdir: /../version_cache: Permission denied
/usr/local/bin/rbenv-communal-gem-home: line 22: /../version_cache/2.6.3: No such file or directory
解決策
/usr/local/bin/rbenv-communal-gem-home 内部の キャッシュのPath が違うらしいので変更。 (例)
/usr/local/bin/rbenv-communal-gem-home
14 + cachedir="$RBENV_ROOT/.communal-gem-version-cache"
15 # cachedir="${BASH_SOURCE%/*}/../version_cache"
参考