I am finding it impossible to get jekyll up and running on a new Mac equipped with the M1 CPU (ARM64). I know that some have had success by relying on a package manager, despite the fact that the most popular one on the Mac (homebrew) only has very preliminary support for the M1.
So… is it still supposed to be possible to install jekyll on a vanilla Mac configuration? On an Intel Mac it takes a few seconds to get jekyll up and running.
I hope someone who sympathizes with the “simplest possible installation strategy”, and with more experience with ruby can help. Here are the steps I followed:
-
I have installed the latest version of Xcode (2.2 at the time of this writing) which includes development tools.
-
I have run: gem install --user-install bundler jekyll which has the side effect of installing gems under ~/.gem/ruby/2.6.0/gems and thus does not run against file permissions on the /Library/Ruby folder. Some posts mention SIP as the problem but I do not think that is correct… you can’t sudo past SIP. The fact that admins no longer have write permissions to that location is probably just Apple protecting the standard Ruby environment for unauthenticated modification.
-
Some (likely outdated) posts suggest that you have to edit your GEM_HOME and GEM_PATH environment variables to get gems installed under your home directory recognized and loaded, but: A) that didn’t make a difference for me B) it doesn’t seem necessary to mess around with environment variables because an invocation of gem env reveals that the version of gem running on macOS is already adding the user-specific gem directory to its GEM_PATHS:
- GEM PATHS:
- /Library/Ruby/Gems/2.6.0
- /Users/me/.gem/ruby/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM PATHS:
-
gem update runs without problems.
-
I can cd to a directory containing my Jekyll site, and I can also run bundle update without problems
-
So what happens when I invoke the jekyll command? I get the following error:
[…]
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:inrequire' /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
require’: dlopen(/Users/gds/.gem/ruby/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Users/gds/.gem/ruby/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle - /Users/gds/.gem/ruby/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle ( LoadError )
OK, so as an ignoramus on Ruby, I can deduct that FFI is a component required by jekyll/rubygems. My first thought is that this is compiled, and it lacks the arm64 binary. But when I cd to that directory and run lipo on that file…
lipo -info ffi_c.bundle
Architectures in the fat file: ffi_c.bundle are: x86_64 arm64e
…it clearly looks like both Intel and ARM binaries are present.
What gives?