Executing error of $ gem install bundler Jekyll..

Executing error of $ gem install bundler Jekyll.

I would like to share how I solve the error when installing Jekyll.Here are the steps to do when you get error when installing Jekyll. The error I get is

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

After a few research, I found that when you see this error you would want to install another Ruby. It is better not to mess up with any ruby that is installed underneath .gem.

To see the file underneath .gem

  1. $ ls -l -a
  2. $ cd .gem
  3. $ cd ruby
  4. $ ls
    And you will see. 2.6.0

As I mentioned earlier, you might want to install another Ruby To do this on Mac:

  1. $ brew install ruby
  2. $ echo ‘export PATH=”/usr/local/opt/ruby/bin:$PATH”’ » ~/.bash_profile
  3. $ source ~/.bash_profile
  4. $ which ruby And you will see. /usr/local/opt/ruby/bin/ruby

Then check ruby -v And you will see. ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]

Then run

  1. $ gem install bundler Jekyll or sudo gem install -n /usr/local/bin jekyll And you will see.
    Fetching bundler-2.1.4.gem Successfully installed bundler-2.1.4

  2. $ Jekyll new my-new-site
  3. $ ls
  4. $ cd my-new-site
  5. $ bundle exec jekyll serve

Turn on your web browser and type http://localhost:4000

Thank you for reading!