jekyll: gem install jekyll failed on Mac OS X 10.11
$ 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)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 39 (18 by maintainers)
Proposed Checklist for Mac OS X 10.11 El Capitan
xcode-select --install
export PATH=/usr/local/bin:$PATH
launchctl setenv PATH "/usr/local/bin:$PATH"
brew install ruby
gem install jekyll
Note: Homebrew is designed to work without using sudo.
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.
This is contrast to Yosemite where I needed to use sudo:
Since I no longer have a “stock” system, it would be helpful if someone else who just installed could validate this approach.
If the install instructions do not work on Mac, it should not be stated that this project supports Mac OS X.
Hi I got the same error as you did, likely because of macOS’s system integrity protection. This fixed it for me
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 tojekyll
.Installing this way installs for and within the user account [only], instead of system-wide.
Have a few moments and want to reiterate, and re-share-- in a summary format, that installing
jekyll
(gems
in general) by leveraging thegem
executable capabilities to isolate ruby gem installations works out of box with OS X 10.11 for example with [only] the following, with the added benefit of leaving the system completely alone, and isolatingjekyll
and its dependencies to the current user/group [only]:If System-wide meddling with a tinker-hostile environment is not your interest, and or you don’t want/need custom/specific Ruby environment(s) (
rbenv
,chruby
,RVM
, …), then a --user-install approach may be worth considering. And it works with stock OS X (10.11 currently
).I ended up using sudo gem install jekyll and it worked perfectly
Your comments help us none @fulldecent provide more information or refrain from commenting.
@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.
@debbarmaonit The short answer to your question is that you can’t set
usr/bin
as the install location on 10.11 because SIP prevents it. There are instructions on Jekyll’s website for how to resolve this issue.If however, you are familiar with either rbenv or RVM, you can instead create an isolated environment that doesn’t conflict with the system’s version of Ruby and then install with just
gem install jekyll
.This worked for me (on Mojave):
Install homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update ruby:
brew install ruby
Set ruby in your PATH:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Install Jekyll into a folder that isn’t protected by SIP:
sudo gem install -n /usr/local/bin/ jekyll
I am working on a PR to update those docs.