Jekyll-Step1.安裝環境
ChrisLin, 06 September 2021
macOS使用Homebrew安裝Ruby & Jekyll
1.macOS 使用Homebrew安裝環境 參考連結
- 安裝 Homebrew
# Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- 安裝 Ruby
# Install Ruby brew install ruby
- 將 brew ruby 和 gems 路徑添加到您的 shell 配置中
# If you're using Zsh echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.zshrc # If you're using Bash echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/3.0.0/bin:$PATH"' >> ~/.bash_profile # Unsure which shell you are using? Type echo $SHELL
- 重新啟動您的終端並檢查您的 Ruby 設置
which ruby # /usr/local/opt/ruby/bin/ruby ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468)
2.安裝 bundler 和 jekyll gems
gem install --user-install bundler jekyll
3.創立Jekyll專案並cd帶該目錄中
jekyll new blog
cd blog
4.執行專案
- 第一次用
bundle exec jekyll serve
- 若Jekyll 服務在 Ruby 3.0 上失敗 缺少 webrick 參考連結
bundle add webrick
- 之後都用
jekyll serve
- 本地端開啟
瀏覽到http://localhost:4000