I don’t think introducing rvm is a good idea as it is another tool to learn and manage.
The comment as above is that the user does not have access to write to here, only read:
/var/lib/
This is secure by design.
sudo
One option as mentioned above is
sudo gem install GEM
But that is insecure and not recommended. For example, some malicious code in the gem or a subdepedency could install malware or wipe the hard drive, using root access.
chmod
An alternative, if you have the ability to run sudo, is to allow all users other than root to write to that gems directory.
sudo chmod +w /var/lib
You might have to run that on gems with that or use a recursive flag.
Then, without sudo, install there.
gem install GEM
While that command can’t wipe your hard drive or anything else as root, it can install malicious software in that shared directory across users.
User level
The safest without having to use sudo at all is:
gem install GEM --user-install
Which installs to somewhere like ~/.gem
depending on your OS or version or Ruby.
And it keeps your user’s gems independent of the root gems or shared gems.
Local project
I would avoid installing Jekyll using the gem command. As then you have a global Jekyll that might clash between projects that need 3.8 or 3.9 or 4.1
So rather add Jekyll to project specific gems in Gemfile
bundle add jekyll
That will add to Gemfile and install Jekyll.
Alt
BTW the Mac instructions suggest passing a flag -n to install in /usr/local/bin