Build jekyll environment under Mac

Original link: https://blog.kelu.org/tech/2023/08/15/jekyll-on-mac.html

The reason why I don’t use docker is because my current local environment is rarely used for large-scale development, and docker consumes more system resources, so I don’t want to run it.

First install chruby using homebrew:

 brew install chruby ruby-install xz 

image-20230818174743688

Install ruby:

 ruby-install ruby 3.1.3 

image-20230818174806883

Waiting for a long time:

image-20230818175059111

Set some environment variables:

 echo "source $(brew --prefix)/opt/chruby/share/chruby/chruby.sh" >> ~/.zshrc echo "source $(brew --prefix)/opt/chruby/share/chruby/auto.sh" >> ~/.zshrc echo "chruby ruby-3.1.3" >> ~/.zshrc # run 'chruby' to see actual version

If you are using bash, change .zshrc to .bashrc

Notice ⚠ , this configuration is required here, otherwise an error will be reported when running the following command:

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

Install Jekyll

 gem install jekyll

Install some plugins:

 gem install jekyll-paginate

run:

 jekyll serve

References

This article is transferred from: https://blog.kelu.org/tech/2023/08/15/jekyll-on-mac.html
This site is only for collection, and the copyright belongs to the original author.