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?
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.
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"
export PATH="$GEM_PATH:$PATH"
Then reload your terminal or start a new tab.
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
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.
Gemfile
.gem 'jekyll', '~> 3.8.5'
bundle install --path vendor/bundle
bundle exec jekyll
Note you can only run Jekyll from the root of this project and not for other projects.