Issues with jekyll rights on apple M1

Dear all,

I am trying to run jekyll on my macbook air M1. I’ve been following this guide:

It seems to work and when I run ruby -v it shows I am using ruby version 3.1.2. Installing jekyll and bundler also works fine. However when I try to run certain jekyll commands it seems to run into some issues. For example when doing jekyll new my-awesome-website it complains about rights for creating a folder:

/Users/user/.rubies/ruby-3.1.2/lib/ruby/3.1.0/fileutils.rb:243:in `mkdir’: Permission denied @ dir_s_mkdir - /Users/svillerius/Projects/my-awesome-site (Errno::EACCES)

When I try to run the same command elevated it tells me it cannot find the gem. I assume because it then uses the default ruby environment macOs ships with:

/Users/user/.rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems.rb:265:in `find_spec_for_exe’: can’t find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)

Not sure where to go from here. How do I give jekyll the rights to do what it needs to do but prevent it from using the default ruby installation?

I’ve sort of solved it by running “chown user Projects” for the whole projects folder and user. It feels dirty though. However it is my personal laptop and I will only be using one user so I guess it’s fine in this case.

If it helps any, I created a video that works successfully on Apple Silicon:

Install Jekyll on Apple Silicon (Jamstack)

However, I’m now a convert and used Docker, so here’s how I do it on my Mac:
Develop Jekyll websites in a container (including GitHub Pages)

Hope you find these useful!