π§ Ruby Version Fix Guide
β Problem
ffi-1.17.4-x86_64-darwin requires ruby version >= 3.0, < 4.1.dev,
which is incompatible with the current version, ruby 2.6.10p210
β Solution Options
Option 1: Update Ruby (Recommended)
Using rbenv (macOS/Linux)
# Install rbenv if not already installed
brew install rbenv
# Install Ruby 3.1
rbenv install 3.1.0
rbenv global 3.1.0
# Add to your shell profile
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
# Verify version
ruby -v
Using rvm (macOS/Linux)
# Install rvm if not already installed
\curl -sSL https://get.rvm.io | bash -s stable
# Install Ruby 3.1
rvm install 3.1.0
rvm use 3.1.0 --default
# Verify version
ruby -v
Using Homebrew (macOS)
# Install Ruby
brew install ruby
# Add to PATH
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# Verify version
ruby -v
Option 2: Use Older ffi Version
Edit your Gemfile to use an older, compatible version:
# Add this to your Gemfile
gem 'ffi', '~> 1.15.0'
Then run:
bundle install
Option 3: Bypass Bundle Install
If you just want to test the website without updating Ruby:
# Skip bundle install and use Jekyll directly
gem install jekyll
jekyll serve --livereload --port 4000
Note: This may not work if other gems have version conflicts.
Option 4: Use Docker
Create a Dockerfile:
FROM ruby:3.1-slim
WORKDIR /app
COPY . .
RUN bundle install
EXPOSE 4000
CMD ["jekyll", "serve", "--livereload", "--host", "0.0.0.0"]
Run with:
docker build -t my-jekyll-site .
docker run -p 4000:4000 my-jekyll-site
π― Recommended Steps
For Quick Testing
- Try Option 2 (older ffi version) first
- If that doesnβt work, use Option 3 (bypass bundle)
For Long-term Development
- Use Option 1 (update Ruby) - recommended
- Or use Option 4 (Docker) for isolated environment
π Check Your Ruby Version
# Check current version
ruby -v
# Check which Ruby is being used
which ruby
# Check rbenv versions (if using rbenv)
rbenv versions
# Check rvm versions (if using rvm)
rvm list
π After Fixing Ruby Version
Once you have Ruby 3.0+ installed:
# Verify version
ruby -v
# Should show: ruby 3.1.x or higher
# Install dependencies
bundle install
# Start development server
npm run dev
# or
bundle exec jekyll serve --livereload --port 4000
# Open in browser
open http://localhost:4000
π Troubleshooting
If rbenv/rvm commands not found
# For rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
source ~/.zshrc
# For rvm
source ~/.rvm/scripts/rvm
If bundle install still fails
# Clear bundle cache
rm -rf vendor/bundle
rm Gemfile.lock
# Try again
bundle install
If Jekyll wonβt start
# Check for port conflicts
lsof -i :4000
# Use different port
bundle exec jekyll serve --port 4001
β Verification
After fixing, verify everything works:
# Check Ruby version
ruby -v
# Check bundle install
bundle install
# Start server
bundle exec jekyll serve --livereload --port 4000
# Open browser
open http://localhost:4000
Choose the option that works best for your setup! π