I followed the instructions at https://jekyllrb.com/docs/installation/macos/ and ultimately ran into this error. Here are some other things I ran into along the way.
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
export SDKROOT=$(xcrun --show-sdk-path)
Just went to a new line in the terminal with no message. seemed successful.
Install Homebrew
(was already installed)
brew install ruby
fatal: Could not resolve HEAD to a revision Warning: No available formula with the name "ruby". ==> Searching for similarly named formulae... These similarly named formulae were found: homebrew/portable-ruby/portable-libyaml homebrew/portable-ruby/portable-ncurses homebrew/portable-ruby/portable-openssl homebrew/portable-ruby/portable-readline homebrew/portable-ruby/portable-ruby homebrew/portable-ruby/portable-zlib To install one of them, run (for example): brew install homebrew/portable-ruby/portable-libyaml ==> Searching for a previously deleted formula (in the last month)... Error: No previously deleted formula found. ==> Searching taps on GitHub... Error: No formulae found in taps.
# If you're using Zsh
echo 'export PATH="/usr/local/opt/ruby/bin:/usr/local/lib/ruby/gems/2.6.0/bin:$PATH"' >> ~/.zshrc
Just went to a new line in the terminal with no message. seemed successful.
Quit and relaunched Terminal.
which ruby
/usr/bin/ruby
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
gem install --user-install bundler jekyll
WARNING: You don't have /Users/my-username/.gem/ruby/2.6.0/bin in your PATH, gem executables will not run. Successfully installed bundler-2.3.9 Parsing documentation for bundler-2.3.9 Done installing documentation for bundler after 0 seconds Building native extensions. This could take a while... ERROR: Error installing jekyll: ERROR: Failed to build gem native extension.
current directory: /Users/my-username/.gem/ruby/2.6.0/gems/eventmachine-1.2.7/ext /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20220321-36161-h5kjlp.rb extconf.rb checking for -lcrypto... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
(some info about configuration omitted)
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in
block in try_link0' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:inmktmpdir' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in
try_link0' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:intry_link' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in
try_func' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:inblock in have_library' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in
block in checking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:inblock (2 levels) in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
open' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:inblock in postpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
open' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:inpostpone' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
checking_for' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:inhave_library' from extconf.rb:8:in
block in check_libs' from extconf.rb:8:inall?' from extconf.rb:8:in
check_libs' from extconf.rb:95:in `'To see why this extension failed to compile, please check the mkmf.log which can be found here:
(file path omitted)
Mac OS 11.6.3