- 更新ruby到最新版本
brew install ruby
...
ruby is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have ruby first in your PATH, run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
For pkg-config to find ruby you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
接下来直接使用/usr/local/opt/ruby/bin
目录下的gem
- 修改源
/usr/local/opt/ruby/bin/gem sources --remove https://gems.ruby-china.com/ /usr/local/opt/ruby/bin/gem sources -a https://mirrors.cloud.tencent.com/rubygems/
- 安装
/usr/local/opt/ruby/bin/gem install jekyll github-pages /usr/local/opt/ruby/bin/bundle add webrick
- 运行
/usr/local/opt/ruby/bin/bundle exec jekyll serve