macOS Monterey安装Jekyll

macOS版本Monterey。

先看官方教程https://jekyllrb.com/docs/installation/macos/,结果执行到以下这一步ruby-install ruby时报错。
错误日志如下:

>>> Updating ruby versions ...
!!! Failed to download https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt to /Users/xxx/.cache/ruby-install/ruby/versions.txt!
!!! Failed to download ruby versions!

直接访问https://raw.githubusercontent.com/postmodern/ruby-versions/master/ruby/versions.txt可以访问,Google、百度搜了半天没有找到相关解决方案。

安装Ruby

无奈去了Ruby官网
https://www.ruby-lang.org/en/documentation/installation/#homebrew
找到官方教程。

brew install ruby

貌似一下装成功了。
ruby -v看了一下还是ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.x86_64-darwin21]

切换Ruby版本

按照提示执行以下下命令,切换到最新版本。

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

ruby -v命令,输入ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20],对了。

安装Jekyll

再回到之前jekyll安装步骤,执行以下命令:

gem install jekyll

噼里啪啦,装好了。

看step by step教程https://jekyllrb.com/docs/step-by-step/01-setup/

gem install jekyll bundler

进入工作目录

cd ~/Workspace/yourname.github.io

初始化生成Gemfile,类似nodejs npm。

bundle init

vi编辑Gemfile文件。

# frozen_string_literal: true
source "https://rubygems.org"
gem "jekyll"

执行bundle命令

bundle

执行jekyll build

bundle exec jekyll build

jekyll serve

bundle exec jekyll serve

打开浏览器,访问http://localhost:4000,可以看到页面了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值