jekyll: problem with gem env >> -bash: command not found

so I’m struggling running Jekyll I’m a newb). I had it working the other day but after I tried hosting it in Github pages it stopped working and I keep getting -bash: jekyll: command not found

I’ve tried deleting all gems, reinstalling everything and so on. I installed Jekyll using Homebrew. If I do gem env I get the following and I think the problem must be with the shell pat and/or gem path.

RubyGems Environment:
  - RUBY VERSION: 3.0.0 (2020-12-25 patchlevel 0) [x86_64-darwin19]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/3.0.0
  - USER INSTALLATION DIRECTORY: /Users/alessandrolodola/.local/share/gem/ruby/3.0.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - GIT EXECUTABLE: /usr/local/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/3.0.0/bin
  - SPEC CACHE DIRECTORY: /Users/alessandrolodola/.local/share/gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/3.0.0_1/etc
     - ruby
     - x86_64-darwin-19
     - /usr/local/lib/ruby/gems/3.0.0
     - /Users/alessandrolodola/.local/share/gem/ruby/3.0.0
     - /usr/local/Cellar/ruby/3.0.0_1/lib/ruby/gems/3.0.0
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - /Users/alessandrolodola/.gem/ruby/3.0.0/bin
     - /Users/alessandrolodola/.gem/ruby/3.0.0/bin
     - /Users/alessandrolodola/.gem/ruby/X.X.0/bin
     - /usr/local/opt/ruby/bin
     - /Users/alessandrolodola/.gem/ruby/3.0.0/bin
     - /usr/local/opt/ruby/bin
     - /Users/alessandrolodola/.gem/ruby/3.0.0/bin
     - /usr/local/opt/ruby/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /Library/Frameworks/Mono.framework/Versions/Current/Commands

I’m guessing I need to delete some of these redundant folders which I must have created accidentally as I’m learning on the fly here. Would it maybe be easier to reinstall everything. If so, what is the best way to do it and make sure I have a clean installation. Thanks in advance for the help.


For Jekyll use, I’d first suggest downgrading Ruby

brew uninstall ruby
brew install ruby@2.7

And comment out everything from bashrc and zshrc file around ruby paths so you can start clean.

And yes you can delete any folders around gems.

It looks like you are using Bash, so only your bash configs matter.

Here are my instructions for setup on mac.

As in that doc, I’d recommend using Jekyll as a project gem installed with bundle, rather than as a global gem

And based on your initial post, I looks like you want to use Jekyll globally.

Ruby 3 is not ready yet for Jekyll use but here is what you can do for global Jekyll

This is already in your path (though with 3 instead of 2.7), which means Jekyll could be found if installed there.


You could install Jekyll as

gem install jekyll --user-install 

For GH pages you need Jekyll 3.9 so I you need to add something like --version 3.9.

And you must also install kramdown-parser-gfm, which is needed for 3.9 (but not 3.8 or 4).

In a Gemfile for use with bundle: