keng.blog

Random Access Memory.

Installing Jekyll on Apple Silicon

02 January 2021

I just switched my daily laptop from the ThinkPad X1 Carbon to the one with an Apple Silicon. The transition was almost seamless but Jekyll was not be able to run on the Apple arm64 architechture. Furtunately, Apple’s Rosetta Translation Environment enables running x86_64 code through the command arch -X86_64, including Jekyll and friends to work.

This guide works as of January 2nd, 2021.

Installing Homebrew

Homebrew is the one currently not fully functioned on arm64 though ~70% of its formula bottles are now support the Apple Silicon.

arch -X86_64 brew update && arch -X86_64 brew upgrade

Installing rbenv

I don’t know much about Ruby and rbenv is one of the recommended methods. I believe this would help reducing library conflict similar to Python’s virtualenv.

# Install rbenv and ruby-build
brew install rbenv

# Set up rbenv integration with your shell
rbenv init

I’m using zsh so I need to add the this to .zshrc.

eval "$(rbenv init -)"

Make sure you have the version that is currently suggest by the installation guide.

rbenv install 2.7.2
rbenv global 2.7.2
ruby -v

Since we’re installing Ruby through the arch -X86_64 the resule of ruby -v should be x86_64 instead of Universal.

ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin20]

Installing Jekyll

Then you can install Jekyll.

arch -X86_64 gem install --user-install bundler jekyll
arch -X86_64 bundle update
arch -X86_64 bundle install

Everything will work as expected as long as your run them through arch -X86_64.