Jekyll - command not found

后端 未结 15 1823

I am trying to get Jekyll running but I have no experience with Ruby.
As far as I can tell the installation of Jekyll has succeeded.
However:

$ jekyll


        
相关标签:
15条回答
  • 2021-01-31 02:53

    For others coming here with the following set up:

    OS X + brewed install of ruby + (possibly) zsh

    I figured the problem is that after installing jekyll as per their instructions, gem installs the jekyll gem in the brew cellar, not where the OS usually expects it (somehwere in a gem directory for ruby).

    So, all that was needed here was to find out where the brew install of ruby installs gems, locate the jekyll binary, and create a symbolic link to it in /usr/bin.

    Here is are the steps I took to fix it:

    1. Type gem env and look for GEM PATHS. For me it was:

      /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1.

    2. Make sure you can see the jekyll binary in the directory from 1 above and copy its path (if you can't, search any other paths listed in GEM PATHS for it). For me it was:

      /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll

    3. Use the path from step 2 above to create a symlink to /usr/bin/jekyll. I did it by typing this (you might need sudo to create the symlink):

      cd /usr/bin && ln -s /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll jekyll

    Now all should be merry if you type jekyll.

    0 讨论(0)
  • 2021-01-31 02:55

    Jekyll is a ruby gem : Ruby gems in linux, for example, are in /var/lib/gems/1.8, as can be seen in the "ruby env" output.

    Thus, you need to add the executables in this directory to your path.

    In general, if a ruby gem is "not found" by your OS, it simply indicates that either

    1) You don't have the gem installed or

    2) You don't have the gem installed in a directory that is on your path.

    I have found that there have been a few issues with installing ruby and ruby gems on linux (I have found that it can be tricky on Ubuntu v10, and have confirmed this with the Ruby folks on IRC). Thus, tools like RVM or rbenv might be the best approach to setting up a stable, maintainable ruby environment.

    0 讨论(0)
  • 2021-01-31 02:56

    Here's an updated answer for 2020 (soon 2021). To install any Ruby gem, whether it's Jekyll, Bundler, Rails, etc., you need a proper Ruby development environment on a Mac. There are various ways to install Ruby on a Mac, as I have written about in great detail in my definitive guide to installing Ruby gems on a Mac. The only one I recommend is to use a Ruby manager because it's the most flexible and sets you up for success for the long term. My preferred one is chruby because it's the lightest and easiest to use. As part of installing Ruby, you also need to properly configure your shell startup file (typically ~/.zshrc or ~/.bash_profile) so that it knows where to find the gems you install. Otherwise, you'll get the "command not found" error, which I've also written about.

    Since there are several steps involved in setting up a working Ruby development environment on a Mac, I wrote some scripts to automate the whole process and make things easier and faster for people. You can read more about the scripts in my guide mentioned above.

    0 讨论(0)
提交回复
热议问题