jekyll icon indicating copy to clipboard operation
jekyll copied to clipboard

gem install jekyll failed on Mac OS X 10.11

Open ghost opened this issue 11 years ago • 39 comments

$ gem install jekyll

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

Mac OS X 10.11 (15A282a) Xcode 7.0 (7A220)

ghost avatar Sep 21 '15 02:09 ghost

I prefer...

$ gem install --user-install --bindir ~/bin --no-document --pre --verbose jekyll

Then... i.e....

  • $ ~/bin/jekyll new ~/Sites/testjekyll
  • $ ~/bin/jekyll serve --watch --verbose ~/Sites/testjekyll

And or add ~/bin to your $PATH shell variable to avoid requiring full path to jekyll.

Installing this way installs for and within the user account [only], instead of system-wide.

jaybe-jekyll avatar Sep 21 '15 04:09 jaybe-jekyll

This is not a Jekyll bug, please ask your question at https://talk.jekyllrb.com as this medium is for bugs.

envygeeks avatar Sep 21 '15 04:09 envygeeks

@jaybe-jekyll Brilliant, thanks.

Successfully installed jekyll-3.0.0.pre.beta8 17 gems installed

FYI, I think Apple has locked down the system directories in OS X 10.11, so the easy-install instructions on http://jekyllrb.com may need to change. Even using sudo won't work.

ghost avatar Sep 21 '15 04:09 ghost

@envygeeks Is there a process for reporting documentation bugs?

ghost avatar Sep 21 '15 04:09 ghost

What do you think is a bug @chmaynard?

envygeeks avatar Sep 21 '15 04:09 envygeeks

The easy-install instructions for jekyll don't seem to work in OS X 10.11 (El Capitan). Apple plans to release this new version of OS X in a few weeks, so you folks might want to investigate.

ghost avatar Sep 21 '15 04:09 ghost

If you are using RVM or Rbenv to do the install ( -- they installed ruby and rubygems -- ) via non-root userland you'll need to file a bug with them, if you are using system Ruby, it never worked the way you expected it to because you need to sudo to do system installs. If it did work before that then that is a glaring security bug for OS X.

envygeeks avatar Sep 21 '15 04:09 envygeeks

We also hint at t he need to sudo in the troubleshooting: http://jekyllrb.com/docs/troubleshooting/#installation-problems it could use a reworking though and if I recall somebody submitted or is going to submit the changes.

envygeeks avatar Sep 21 '15 04:09 envygeeks

@envygeeks I know almost nothing about Ruby, so please excuse my ignorance. It sounds like I must have used "sudo gem install" at some point in the past. I'm now wondering what will happen when the average user tries to install jekyll on a clean copy of OS X 10.11. Maybe I'll try that myself.

ghost avatar Sep 21 '15 05:09 ghost

If the install instructions do not work on Mac, it should not be stated that this project supports Mac OS X.

fulldecent avatar Sep 22 '15 16:09 fulldecent

Your comments help us none @fulldecent provide more information or refrain from commenting.

envygeeks avatar Sep 22 '15 16:09 envygeeks

My sarcasm is used to illustrate that this issue should remain open.

This approach worked for me with OS X 10.11 15A282b. However, the other Mac advice at http://jekyllrb.com/docs/troubleshooting/#installation-problems did not work.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby
gem install jekyll

This is contrast to Yosemite where I needed to use sudo:

sudo gem install jekyll

Since I no longer have a "stock" system, it would be helpful if someone else who just installed could validate this approach.

fulldecent avatar Sep 22 '15 17:09 fulldecent

@fulldecent Thanks for your advice. I hadn't thought about using Homebrew to install Ruby. That makes perfect sense because Homebrew will install Ruby into /usr/local instead of /Library/Ruby, which may be off-limits if Apple SIP is enabled.

ghost avatar Sep 22 '15 20:09 ghost

Summary

The installation problem occurs because OS X ships with a copy of Ruby in /Library/Ruby, a directory which is owned and controlled by the OS. In past versions of OS X, a new jekyll user could use sudo gem install jekyll to install software into this directory. That may not be possible in OS X 10.11, because Apple is now using System Integrity Protection (SIP) to further restrict write access to some system directories.

@fulldecent found a good work-around for 10.11:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install ruby
gem install jekyll

A drawback with this work-around is that the user needs to install Homebrew and Ruby before installing jekyll. The user may also need to update their $PATH variable to give /usr/local/bin precedence over /usr/bin.

ghost avatar Sep 22 '15 21:09 ghost

It would be helpful to re-open this issue to give it more visibility.

ghost avatar Sep 22 '15 21:09 ghost

I just tried the work-around described above and it worked flawlessly.

ghost avatar Sep 23 '15 21:09 ghost

@chmaynard Thanks for your help. Is your system a stock upgrade or install? And have you installed Xcode command line tools before doing this?

I just want to track all the factors here.

fulldecent avatar Sep 23 '15 22:09 fulldecent

@fulldecent I previously installed both Xcode and Homebrew. We probably need to refine your install procedure for people who are not developers. See below.

ghost avatar Sep 24 '15 04:09 ghost

Proposed Checklist for Mac OS X 10.11 El Capitan

  • [ ] Install the Xcode command line utilities xcode-select --install
  • [ ] Install Homebrew (instructions at http://brew.sh)
  • [ ] Modify $PATH to use Homebrew export PATH=/usr/local/bin:$PATH
  • [ ] Modify $PATH for GUI apps launchctl setenv PATH "/usr/local/bin:$PATH"
  • [ ] Install the latest Ruby brew install ruby
  • [ ] Install the latest Jekyll gem install jekyll

Note: Homebrew is designed to work without using sudo.

ghost avatar Sep 25 '15 07:09 ghost

Please add the "Documentation" label to this issue.

ghost avatar Sep 25 '15 13:09 ghost