One of those snags I ran into today was reinstalling Jekyll (and by relation, Ruby). It's tricky because macOS comes preinstalled with Ruby 2.0.0 which makes you think you are all set but there are a ton of complications with it so it's better to just install your own copy of Ruby on your machine.
One of the issues was that when I tried to install Jekyll with my system Ruby, it provided the following error:
- ERROR: While executing gem ... (Gem::FilePermissionError). You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory
It wasn't any easier when I tried to install it using sudo. Thus, I googled and after some frustration searching I found the solution.
I'm documenting it here on my website so that I (and hopefully others) can find it easy in the future.
First you need to install Xcode.
Then, Install the Xcode Command Line Tools
- xcode-select --install
Open Xcode or run the following code and agree to the terms
- sudo xcodebuild -license
- /usr/bin/ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))"
- brew install ruby
- sudo gem install jekyll
- jekyll -v