Installation probelm: zsh: command not found: jekyll

I am having difficulty installing Jekyll. The gem gets is installed but when I issue jekyll serve i get zsh: command not found: jekyll

Would really appreciate it if somebody could help me out?

Have you tried
bundle exec jekyll ?

I think the issue is that the Jekyll is installed in a gems location with in not in your PATH variable in your shell.

I recently went through setting up Ruby and Jekyll on macOS using ZSH. Here is what I arrived at.

1. Update config

Update your shell config - add this to your .bashrc (for Bash) or .zshrc (for ZSH). You might need a different ruby version but this is the latest for macOS at the moment.

export GEM_PATH="$HOME/.gem/ruby/2.6.0/bin"

Then reload your terminal or start a new tab.

2. Reinstall Jekyll

You might want to uninstall the current Jekyll to avoid confusion. Then install it as belw.

Install the Jekyll gem at the user level (i.e. not shared by all users and not in a specific project). By default, this will install to the ~/.gems directory.

$ gem install --user-install jekyll

3. Run

Now run this from anywhere:

which jekyll
jekyll serve

Adding onto the answer by @michaelbach and assuming you want to try using Bundler

You can install Jekyll as a gem in your project and lock it down to a version. Then you never have to install Jekyll for your user.

1. Specify Jekyll in your Gemfile.

gem 'jekyll', '~> 3.8.5'

2. Install

bundle install --path vendor/bundle

3. Run

bundle exec jekyll

Note you can only run Jekyll from the root of this project and not for other projects.