This is my personal blog/website built with Jekyll and hosted on GitHub Pages.
- A Unix-like OS (Ubuntu, other Linux distributions, or macOS)
- Ruby (version 2.7.0 or higher; GitHub Pages currently uses Ruby 3.1.x)
- Git
- Bundler
sudo apt update
sudo apt install ruby-full build-essential zlib1g-devWe recommend using rbenv to manage Ruby versions:
- Install rbenv and ruby-build using Homebrew:
# Install Homebrew if not already installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install rbenv and ruby-build
brew update
brew install rbenv ruby-build- Set up rbenv in your shell:
# For zsh (macOS default since Catalina)
echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
source ~/.zshrc
# For bash
# echo 'eval "$(rbenv init - bash)"' >> ~/.bash_profile
# source ~/.bash_profile- Install and set Ruby 3.1.2:
rbenv install 3.1.2
rbenv global 3.1.2- Verify the installation:
ruby -v # Should show ruby 3.1.2
which ruby # Should point to ~/.rbenv/versions/3.1.2/bin/rubyAvoid installing gems with sudo by setting up a user-specific gem directory.
Add the following lines to your shell config file (~/.bashrc or ~/.zshrc):
# Install RubyGems to ~/gems
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"Then apply the changes:
source ~/.bashrc # or source ~/.zshrcVerify setup:
echo $GEM_HOME # Should be /home/youruser/gems
echo $PATH # Should include /home/youruser/gems/binUse gem to install both:
gem install bundler jekyllCheck installation:
bundler -v
jekyll -vDo not install Bundler using apt. That can lead to version conflicts and path issues.
git clone https://github.com/ferjorosa/ferjorosa.github.io.git
cd ferjorosa.github.ioSet Bundler to install project-specific dependencies in a local folder:
bundle config set --local path 'vendor/bundle'bundle installThis will install all gems into the vendor/bundle directory, keeping them isolated from other projects.
bundle exec jekyll serve --port 5000Visit your site at http://localhost:5000
Auto-reload on changes:
bundle exec jekyll serve --port 5000 --livereloadShow draft posts:
bundle exec jekyll serve --port 5000 --drafts├── _posts/ # Blog posts
├── _layouts/ # Page layouts
├── _includes/ # Reusable components
├── css/ # Stylesheets
├── js/ # JavaScript files
├── _config.yml # Site configuration
├── Gemfile # Ruby gem dependencies
├── Gemfile.lock # Locked gem versions
└── vendor/bundle/ # Local gem installation directory
Ensure your shell is reloaded and $PATH includes ~/gems/bin:
source ~/.bashrc # or source ~/.zshrcCheck:
which jekyll
which bundlerDouble-check that you're not using sudo with gem.
bundle clean --force
bundle installUse a version manager like rbenv or rvm. To lock the Ruby version for the project:
echo "3.1.2" > .ruby-versionThis setup ensures you're using project-local dependencies, avoiding permission issues, and staying aligned with GitHub Pages' environment.