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?