jekyll已安装,但'命令未找到'

时间:2013-10-09 15:43:42

标签: terminal osx-mountain-lion jekyll

我安装了jekyll,但令人惊讶的是osx不知道它已安装。

$ 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

3 个答案:

答案 0 :(得分:17)

我安装了rbenv,我错过的步骤是在rbenv rehash后执行gem install jekyll。 rehash在〜/ .rbenv / shims中创建一个链接,该链接包含在$ PATH中。

答案 1 :(得分:9)

好的,我必须检查$ PATH的含义是什么,以及它是什么。

问题很简单,不知怎的,我的ruby installion目录不在我的$ path变量中。

有用的链接:Mac OS X: Set / Change $PATH Variable

好的,这就是我如何解决它的问题:

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"

你可以通过在终端上写它而不是保存在你的.bash_profile

中以临时方式执行此操作

答案 2 :(得分:2)

以下步骤解决了我的问题

gem uninstall jekyll
sudo gem install jekyll

打开~/.bash_profile并在最后一行添加此代码

export PATH=$PATH:/usr/local/lib/ruby/gems/1.9.1/gems/jekyll-2.5.2/bin

保存并关闭.bash_profile

关闭并重新打开mac终端,现在尝试运行jekyll,它应该可以正常工作