Search code examples
terminalosx-mountain-lionjekyll

jekyll installed but 'command not found'


I installed jekyll, but surprisingly somehow osx doesn't recognise its installed.

$ sudo gem install jekyll
Password:
Successfully installed jekyll-1.2.1
Parsing documentation for jekyll-1.2.1
Done installing documentation for jekyll after 1 seconds
1 gem installed

$ jekyll
-bash: jekyll: command not found

gem environment ( - INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0 )

$ cd /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/

enter image description here

echo $PATH

/usr/local/bin:/usr/local/sbin:~/bin:/usr/local/bin:/usr/local/sbin:~/bin:/Users/TheSpiritMolecule/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/TheSpiritMolecule/.rvm/bin

Solution

  • Okay I had to check what exatly does the $PATH means, and for what it is.

    The problem was simple, somehow my ruby installion directory wasnt in my $path variable.

    Useful links: Mac OS X: Set / Change $PATH Variable

    Okay so here is the thing how I solved it:

    echo "$PATH"
    gem uninstall jekyll
    find / -name jekyll (to delete if there is any leftovers somewhere )
    gem environment ( get EXECUTABLE DIRECTORY path )
    nano $HOME/.bash_profile ( go to the end of document and insert a new line )
    export PATH="/usr/local/Cellar/ruby/2.0.0-p247/bin:$PATH"
    

    you can do this on a templorary way by just writing it in terminal and not saving it in your .bash_profile