16

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
4

3 回答 3

18

我已经安装了 rbenv 并且我错过的步骤是做一个rbenv rehashafter gem install jekyll。rehash 在 ~/.rbenv/shims 中创建了一个链接,该链接包含在 $PATH 中。

于 2015-07-10T20:26:12.710 回答
10

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

问题很简单,不知何故我的 ruby​​ 安装目录不在我的 $path 变量中。

有用的链接:Mac OS X:设置/更改 $PATH 变量

好的,这就是我解决它的方法:

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

于 2013-10-10T09:07:55.187 回答
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现在尝试运行,它应该可以工作

于 2014-12-17T15:28:58.167 回答