You don't have write permissions for the /var/lib/gems/2.3.0 directory


This seems to be a fairly common problem, evidenced by Googling. I have installed Jekyll quite a few times on Windows but this was on a clean install of Ubuntu 16.10…

[email protected]:~$ gem install jekyll
Fetching: public_suffix-2.0.5.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.3.0 directory.


You’d have to use rvm for Ruby and then install gems. Another and unsecure method is to use sudo, but don’t do that.


Thanks but not so sure what it means. I did a fresh Ubuntu install this evening and exactly the same issue again. Can an expert pls help fix this bug?


This is not a bug. Only root (administrator) can install stuff to /var/lib, but doing this is not recommended. You need to use Ruby Version Manager (rvm) or Bundler to create user based installation.

For installation examples see this (rvm) or this (bundler).


Thanks heaps for clarifying that. I am confused however about why the default install instructions for Jekyll don’t mention this. Surely many people are using Ubuntu without being root?


I don’t see this as something for Jekyll to define. It hits me more as a Ruby environment setup than anything.