0%

Please following the simple instructions to install Ruby.

How to install Homebrew

1
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

How to install ruby normally

Don’t use sudo to use gem when it notices no write permissions.

1
2
3
$ gem install jekyll
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

Install rbenv and ruby-build

1
$ brew install rbenv ruby-build

update and reload your appropriate dotfile for rbenv to work.

1
2
3
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.profile
$ echo 'source ~/.profile' >> ~/.zshrc
$ source ~/.profile

Install ruby

1
2
$ rbenv install -v 2.4.2
$ rbenv global 2.4.2

Verify that Ruby was installed properly with this command:

1
2
$ type ruby
$ ruby -v

Verify RubyGems(Ruby’s package manager) liks this:

1
2
$ type gem
$ gem -v

Install bundle

1
$ gem install bundler

Install Jekyll

1
2
$ gem install jekyll
$ rbenv rehash

Test it

1
2
3
$ jekyll new my-awesome-site
$ cd my-awesome-site
$ jekyll serve