Don't do this unless you are a Jekyll developer. You don't need to install Jekyll on your Mac to test your website locally. Use Docker instead. There is a learning curve, but you can use your Docker skills for much more than just testing a static website.
Briefly, you need to (1) download and install Docker Community Edition for Mac, (2) create a DockerHub account and download a Docker image that's configured to run the GitHub Pages software, and (3) learn how to create a container and communicate with it. This is all documented online. Contact me if you need help.