1

When I want to change content of the web page, I go to my local project directory and I run two commands:

jekyll build
jekyll serve

After that, my web app is running locally on my machine. When I tried to run the above commands today, I got stuck on the first of them, because the following error appeared:

$ jekyll build
Traceback (most recent call last):
    5: from /usr/local/bin/jekyll:8:in `<main>'
    4: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
    3: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
    2: from /Users/JaroslavBezdek/.gem/ruby/2.3.0/gems/jekyll-3.8.5/lib/jekyll.rb:34:in `<top (required)>'
    1: from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- safe_yaml/load (LoadError)

I started to look it up on the internet and found I should try to install the missing library. However, it didn't solve the problem, because the other error showed up:

$ gem install safe_yaml
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
$ sudo gem install safe_yaml
Password:
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.

My environment could be described as following:

$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
$ gem --version
3.1.1
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.1
BuildVersion:   19B88

Please, could you help me, how to solve the problem?

Jonathan Southern
  • 1,121
  • 7
  • 22
Jaroslav Bezděk
  • 6,967
  • 6
  • 29
  • 46
  • 1
    Install RVM with `\curl -sSL https://get.rvm.io | bash -s stable`; restart your shell; install Ruby with `rvm install 2.6.0`. [Don't](https://robots.thoughtbot.com/psa-do-not-use-system-ruby) [use](https://chrisherring.co/posts/why-you-shouldn-t-use-the-system-ruby) [system Ruby](http://billpatrianakos.me/blog/2014/05/15/never-use-system-ruby-ever/). – anothermh Dec 16 '19 at 21:35
  • 1
    Alternatively to rvm you can use [rbenv](https://github.com/rbenv/rbenv). – David Jacquel Dec 17 '19 at 04:34
  • @anothermh, thank you for your help. I tried, what you suggested. After that, I tried to build an app with `jekyll build`, but another load error showed up: `/Users/JaroslavBezdek/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file -- pathutil (LoadError)`. Please, do you know, how to solve this? – Jaroslav Bezděk Dec 17 '19 at 08:11
  • Is this your first time running it locally? And does your project have a Gemfile? – Scott Schupbach Dec 17 '19 at 20:47

0 Answers0