Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll - command not found

Tags:

bash

ruby

jekyll

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 

Gives an error:

-bash: jekyll: command not found 

This is the gem env result:

  - RUBYGEMS VERSION: 1.3.4   - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]   - INSTALLATION DIRECTORY: /Volumes/HDD/DADU/gems   - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby   - EXECUTABLE DIRECTORY: /Volumes/HDD/DADU/gems/bin   - RUBYGEMS PLATFORMS:     - ruby     - universal-darwin-10   - GEM PATHS:      - /Volumes/HDD/DADU/gems      - /Volumes/HDD/DADU/.gem/ruby/1.8      - /Library/Ruby/Gems/1.8      - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8   - GEM CONFIGURATION:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000   - REMOTE SOURCES:      - http://gems.rubyforge.org/ 

And I found the following paths leading to "something" Jekyll:

  • ~.gem/ruby/1.8/gems/jekyll-0.11.0/lib/jekyll.rb
  • ~.gem/ruby/1.8/gems/bin/jekyll (exec file)
like image 815
DADU Avatar asked Nov 16 '11 03:11

DADU


People also ask

Where is Jekyll installed?

they should be in the same folder as your source files, inside the _site folder. You can run jekyll from any folder I think as long as the Environment Variable has the path to ruby(?).

How do I know what version of Jekyll I have?

If the OP has installed Jeykll locally (using gem install github-pages for example), then they can see which version of Jeykll they are using by running gem list jeykll from the command line.


2 Answers

If you are using MacOS, from the Troubleshooting guide:

Jekyll & Mac OS X 10.11Permalink

With the introduction of System Integrity Protection, several directories that were previously writable are now considered system locations and are no longer available. Given these changes, there are a couple of simple ways to get up and running. One option is to change the location where the gem will be installed (again, using sudo only if necessary):

$ gem install -n /usr/local/bin jekyll 
like image 144
another Avatar answered Sep 17 '22 13:09

another


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.

like image 22
coderigo Avatar answered Sep 17 '22 13:09

coderigo