After installation, the common 'jekyll' is not found

my machine is Mac with M1,
the following may be useful.

the .zshrc:
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/.gem/ruby/2.6.0/bin:$PATH"

Can you show the steps you did to get here? How did you install Jekyll?

I’m guessing:

gem install jekyll --user-install 

As that will add it to .gem/....

Your Ruby is 3.

Your comment about path to bin for Ruby 2.6.0 won’t help but looking at the screenshot you do still have bin for 3.0.0 in your path.

You also have some values appearing in shell path 2 or even 3 times around Homebrew so see if you can clean that up.

Check where Jekyll was installed to. Does it exist here?

ls ~/.gem/ruby/2.6.0/bin
ls ~/.gem/ruby/3.0.0/bin

Here are the instructions I arrived at for mac and Homebrew. Try these out.

I use /usr/local/... as my path to Homebrew though. Also these are for installing Bundler at the global level, so replace bundle with jekyll in commands.

I actually don’t have Jekyll setup globally anymore. I use Bundler globally. Then each Jekyll project has Jekyl 3 or 4 in a Gemfile. So Bundler will install it to project scoped gems, as per Jekyll setup in my gist.

1 Like

Thank you very much for your help. With your help, I use the command’jekyll’ successfully!
at the first time, i installed ‘jekyll’ without the key ‘–user-install’;I found there was just ‘2.6.0’ in the path ‘~/.gem/ruby/’; after the addition, I have a folder called ‘3.0.0’ ;after I install the jekyll again and add the path to the .zshrc, the command ‘jekyll’ is useful.

I put the environment variables applied by the user in front of the system,so that I can use the ruby I installed with Homebrew.
under the path ‘~/.gem/ruby/2.6.0/’ ,only one folder ’ cache’ exists, I can’t find the jekyll which I installed at the first time .I’ve got all the paths to the files on my computer mixed up since Homebrew is in the folder ’ opt '.

thanks for your help again, And thank you for reading my broken English

1 Like