Skip to content

Instantly share code, notes, and snippets.

@KetchCyork
Last active May 4, 2024 03:03
Show Gist options
  • Save KetchCyork/ab896f1c8e3e845b8d17d3aef169b871 to your computer and use it in GitHub Desktop.
Save KetchCyork/ab896f1c8e3e845b8d17d3aef169b871 to your computer and use it in GitHub Desktop.
Permission error installing Jekyll

My Journey installing Jekyll on my new Macbook Pro

I went to the Jekyll website https://jekyllrb.com/docs/installation/ and read the pre-requisites

I ran each command line recommended to validate the correct prerequisites are installed

Installing Jekyll should be straight-forward if all requirements are met. Before you start, make sure your system has the following: GNU/Linux, Unix, or macOS Ruby version 2.2.5 or above, including all development headers (ruby installation can be checked by running ruby -v, development headers can be checked on Ubuntu by running apt list --installed ruby-dev) RubyGems (which you can check by running gem -v) GCC and Make (in case your system doesn't have them installed, which you can check by running gcc -v,g++ -v and make -v in your system's command line interface)

Then using command line I installed using Ruby Gem via the command

gem install Jekyll

When I did this I got the following error:

gem install jekyll
Fetching: public_suffix-3.0.2.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

My next step was to google "gem install jekyll you don't have write permissions" and I found an article on github recommending a different command line - "$ gem install --user-install --bindir ~/bin --no-document --pre --verbose Jekyll" which gave me a bash error of "command not found".

I then reached out to a friend @mention @davebeach with the error and we realized that out of the box Mac's come installed with Ruby but the permissions are locked down and I needed to give myself ownership of the directory so that the install could complete successfully The first thing I did was navigate to the directory giving me permission issues

cd /Library/Ruby/Gems/2.3.0

Then navigated "up" one level by typing the command

cd ..

then I typed

ls -al

the response was

drwxr-xr-x  3 root  wheel   96 Jul 15  2017 .
drwxr-xr-x  4 root  wheel  128 Jul 15  2017 ..
drwxr-xr-x  8 root  wheel  256 Jul 15  2017 2.3.0

The result told me that I was not the owner of the "2.3.0" directory to complete the install, as well as the fact that I was in the root directory and not within my user directory so the next step was to enter the command

sudo chown christopheryork: 2.3.0

Then I entered my passowrd and then the command

ls -al

and the result was

drwxr-xr-x  3 root             wheel   96 Jul 15  2017 .
drwxr-xr-x  4 root             wheel  128 Jul 15  2017 ..
drwxr-xr-x  8 christopheryork  wheel  256 Jul 15  2017 2.3.0

next I used the command

sudo chown christopheryork:staff 2.3.0

and then the command

ls -al

and the result was

drwxr-xr-x  3 root             wheel   96 Jul 15  2017 .
drwxr-xr-x  4 root             wheel  128 Jul 15  2017 ..
drwxr-xr-x  8 christopheryork  staff  256 Jul 15  2017 2.3.0

Note the directory is now under my ownership

I next ran the command

gem install jekyll

and I got the error

Fetching: public_suffix-3.0.2.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Library/Ruby/Gems/2.3.0/cache/public_suffix-3.0.2.gem

I then navigated back to the correct directory

cd /library/ruby/gems

I entered the command

sudo chown -R christopheryork:staff 2.3.0

Then I issued the command

gem install jekyll

and the result was

Done installing documentation for public_suffix, addressable, colorator, http_parser.rb, eventmachine, em-websocket, concurrent-ruby, i18n, rb-fsevent, ffi, rb-inotify, sass-listen, sass, jekyll-sass-converter, ruby_dep, listen, jekyll-watch, kramdown, liquid, mercenary, forwardable-extended, pathutil, rouge, safe_yaml, jekyll after 50 seconds 25 gems installed

@mcbalz
Copy link

mcbalz commented May 4, 2024

I ended up figuring out that in order to install Jekyll, I had to install Ruby properly, and to do that I needed not to change permissions on the built in mac Ruby install, but to change my terminal from bash to zsh, ignore the native mac Ruby, use the Ruby I had installed via Homebrew, and properly and set the $PATH variable in ~/.zschrc ... and not only that, but I had to set that path using the proper syntax, which is not properly on the otherwise wonderful website Mac Install Guide run by Daniel Kehoe that helped me on my way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment