LoginSignup
1
1

More than 3 years have passed since last update.

ERROR: While executing gem ... (Gem::FilePermissionError)というエラーの対処法

Posted at

Re:Viewをインストールした際に起きたGemのエラー対処法です。
※Re:Viewのインストールでなくても起きます。

$ gem install review

ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

このようなエラーが出力されます。

gemのインストール先の権限が許可されていない

$ sudo gem install review

上記のようにsudoすればインストール出来ると思いますが、今回はユーザー領域にインストールしたいので、インストール先(GEM_HOME)を明示的に指定してエラーを回避してみます。

$ mkdir -p $HOME/rubygems
$ export GEM_HOME=$HOME/rubygems
$ export PATH=$GEM_HOME/bin:$PATH

この3行を~/.zshrcなどに記述しておき完了。

権限によるトラブルがなくなりました。

参考

[ruby] gemをユーザー領域にインストールする - 生活。

1
1
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
1
1