jekyll: Can't install Jekyll on Mac OS Big Sur (Apple Silicon M1)
I can’t install Jekyll in Mac OS Big Sur. I’ve tried different approaches as described in your install pages. None has worked:
https://jekyllrb.com/ https://jekyllrb.com/docs/installation/macos/
I’ve tired first local install and latter global install, both returned the same error messages.
My Environment
Software | Version(s) |
---|---|
Operating System | Mac OS Big Sur (Apple Silicon) M1 |
jekyll |
Latest |
github-pages |
No |
xcode version |
12.4 |
% ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
% which ruby
/usr/bin/ruby
% gem env
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.arm64e-darwin20]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/osvaldogago/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/osvaldogago/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-20
- GEM PATHS:
- /Library/Ruby/Gems/2.6.0
- /Users/osvaldogago/.gem/ruby/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- SHELL PATH:
- /Users/osvaldogago/.gem/ruby/2.6.0/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/Apple/usr/bin
Expected Behaviour
Jekyll should run
Current Behavior
Can’t run any Jekyll command
Code Sample
% jekyll --help
Traceback (most recent call last):
21: from /usr/local/bin/jekyll:23:in `<main>'
20: from /usr/local/bin/jekyll:23:in `load'
19: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.2.0/exe/jekyll:8:in `<top (required)>'
18: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
17: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
16: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll.rb:195:in `<top (required)>'
15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
14: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
13: from /Library/Ruby/Gems/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll-sass-converter.rb:4:in `<top (required)>'
12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
11: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
10: from /Library/Ruby/Gems/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll/converters/scss.rb:3:in `<top (required)>'
9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
7: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<top (required)>'
6: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `require_relative'
5: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<top (required)>'
4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
2: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:4:in `<top (required)>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- 2.6/ffi_c (LoadError)
22: from /usr/local/bin/jekyll:23:in `<main>'
21: from /usr/local/bin/jekyll:23:in `load'
20: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.2.0/exe/jekyll:8:in `<top (required)>'
19: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
18: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
17: from /Library/Ruby/Gems/2.6.0/gems/jekyll-4.2.0/lib/jekyll.rb:195:in `<top (required)>'
16: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
15: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
14: from /Library/Ruby/Gems/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll-sass-converter.rb:4:in `<top (required)>'
13: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
12: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
11: from /Library/Ruby/Gems/2.6.0/gems/jekyll-sass-converter-2.1.0/lib/jekyll/converters/scss.rb:3:in `<top (required)>'
10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
8: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<top (required)>'
7: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `require_relative'
6: from /Library/Ruby/Gems/2.6.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<top (required)>'
5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
3: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:3:in `<top (required)>'
2: from /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi.rb:6:in `rescue in <top (required)>'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle (LoadError)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 12
- Comments: 32 (9 by maintainers)
So I got Jekyll 4.2 to run natively on my M1 MPB!🎉
I’m not 100% sure I’ve captured all the steps below that made it work but it should be the most important steps.
Here’s what I did: From: https://github.com/sass/sassc-ruby/issues/146#issuecomment-534197168 (re)install gems giving arch issues with native extensions
gem uninstall sassc
gem install sassc -- --disable-march-tune-native
gem uninstall ffi
gem install ffi
Update bundler for good measurebundle update --bundler
Addwebrick
because otherwise Jekyll won’t run on Ruby 3.0 https://github.com/jekyll/jekyll/issues/8523bundle add webrick
Make sure to rebuild everything. This threw some errors, I had to run this a few times before it worked.bundle install --redownload
And now:bundle exec jekyll serve
works! 👍@fulldecent @yangzhou6666 That workaround is temporary and also unnecessary because Jekyll works natively on Apple Silicon. It’s a shame to not take advantage of the new chip. Since this seems to be a common problem, I wrote an article that explains how to install Jekyll on Apple Silicon.
@pranjalworm If you’re facing the same exact issue, it’s because you are using the system Ruby that came preinstalled on your Mac. You should not be using the system Ruby. Instead, you need to install a version manager that can install a separate, and more recent version of Ruby. All the steps necessary to set up a complete working Ruby environment on a Mac can get complicated, even more so on M1 Macs, which is why I wrote a script that can automate the whole process for you.
For a more detailed explanation as to why you shouldn’t use the system Ruby, and how to properly install Ruby on a Mac, read my definitive guide to installing Ruby gems on a Mac.
Blunt workaround:
Upgrading to ruby 2.7.2p137 with Macports with rbenv and ruby-build has worked. I’m using the local install method.
Thank you @crispgm Could you please be a little more specific on how to update? I’m not a Ruby developer.
% bundle update
returns:Could not locate Gemfile
For people familiar with Docker, I’ve just created a Docker Image for Jekyll in Apple Silicon (M1 chip). You can try it with:
docker pull osvik/jekyll-apple-silicon:v4.2.0.b2
And create a container with (for example):
docker run -t -d -v ~/Websites:/media/Websites -p 80:80 --name myjekyll osvik/jekyll-apple-silicon:v4.2.0.b2
This will create a link to your ~/Websites folder from the /media/Websites folder in the container.
Now open the CLI in the container and:
bash
service nginx start
- start nginx so you can access your website in http://localhostcd /media/Websites
- This will take you to the ~/Websites folder in your MacNow
cd
to the website folder or create a new one withjekyll new
bundle exec jekyll build
bundle exec jekyll serve
And now you can view your website in localhost
try update ffi to 1.14.2 with
bundle update
, and it would be solved.This solved all the issues. Thanks for making this.
The workarounds are great, but is there any official plan to make Jekyll work with ARM64 out of the box?
Thanks for this. However, this appears only be useful for these who already run HomeBrew flavoured Ruby of
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
as of today but is kinda irrelevant to solving the original issue posted as the issue raised was on the natively Ruby V2.6.3 shipped with Big Sur on Apple Silicon. Before install V3 Ruby via Brew I did have tried a few walk-arounds including uninstall and re-install sash gem package as you suggested but did not replace theffi
as the sys already got higher version. I gained no success eventually.Instead of further messing up the OS I tend to agree with @monfresh just go with HomeBrew for a potentially better Ver 3.0.x Ruby. Similar lessons have been learned by Apple users trying to upgrade/break their shipped Python Ver 2.x on earlier versions of macOS. Just to be clear I did not entirely follow @monfresh for using his great script as I only wanted things simple and fixed on purpose.
After running HomeBrew flavoured Ruby (Ver 3.0.x) I was able to set up Jekyll Ver 4.2 running following the official instructions.
xcode-select --install
. Mine says follows,xcode-select: error: command line tools are already installed, use "Software Update" to install updates
bundler
andjekyll
if you get all
$PATH
correct, your Jekyll should run now.This past weekend I couldn’t install Homebrew 3.0.0 due to an error during the install. This is why I didn’t tried the rvm option. I’m waiting for the 3.0.1…
It would be great if Jekyll could be installed in Big Sur + Apple Silicon following the easier instructions in the home page.