back to /blog

How to locally test your github pages on Mac

[ jekyll  blog  github  ]

I followed this amazing guide from J McGlone to build this static website hosted on github pages. Once I had my basic website running, I started to do some edits, but eventually I got tired of making a thousand commits to test different css styles. To test changes to the website avoiding the deploy time in github, I attempted to run it locally: for this I needed Jekyll and Ruby and Gems bundles. The specific requirements to test github pages are in this github list & this jekyll list. I tried to install each element separately but I encountered several issues, and then I found a repo by Moncef Belyamani from which you can install everything in one step! Thanks internet people for sharing content like this 🥰.

In summary,

  1. To create a simple github pages, clone this repo and follow this guideline to understand the repo structure.

  2. To run your site locally, install ruby, gems and Jekyll from this repo

  3. Create new Jekyll website as shown on this documentation. Note that when you create this project, you will see two files in the project folder: Gemfile and Gemfile.lock

  4. Copy and paste these two Gemfiles into your github pages project folder. While you’re on your github pages folder, run jekyll serve on your terminal. Your local site will be running on this server: Server address: unless you specified any other port in the config yml file or in the jekyll serve statement.

And now I’m able to run my github pages locally 🥳


Be the first and only to leave a comment ever - via github on this ticket. Comments should appear on this page instantly, but I woudln't be surprised if it's not working (my bad).