Skip to main content

ERROR: While executing gem ... (Gem::FilePermissionError) You don‘t have write permissions for

Execute in MacOS environment

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

Analysis error: When we used gem to install, we found that we did not have permission to write under the path /Library/Ruby/Gems/2.6.0

Enter the command ls -alto check the permissions in the directory

1.png

and find that the current permissions are root, not you.

Solution:

input the command

sudo chown -R username /Library/Ruby/Gems/2.6.0

Among them, replace username with the username of the current user.

After that, enter the command again ls -al to view the current permissions.

2.png

At this time, the permissions are modified successfully.

Execute again

gem install jekyll bundler
jekyll new myblog

success!