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:
This is secure by design.
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.
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.
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.
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.
BTW the Mac instructions suggest passing a flag -n to install in /usr/local/bin