18
ERROR:  While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/jekyll

I'm getting a permission error on trying to install Jekyll. I'm currently running OSX 10.11 (El Capitan). I also have Xcode 7 and have installed the developer tools. Is there a workaround or is this an OS specific issue?

lenignes
  • 333
  • 1
  • 5
  • 17
  • could u try reinstall Xcode CLI tools? Also, try something like this here, which also requires a reinstall: http://jtimberman.housepub.org/blog/2012/02/26/xcode-command-line-tools/ – matrixanomaly Jul 22 '15 at 17:48

9 Answers9

28

This is a side effect of Apple's new rootless (aka System Integrity Protection or SIP) feature in OS X El Capitan, but it does not affect /usr/local/bin.

You might try the following:

sudo gem install -n /usr/local/bin/ jekyll

This tells gem to install Jekyll into a folder that isn't protected by SIP, rather than the default protected location under /Library/Ruby/Gems.

This is the solution suggested by Jekyll's developers.

Alistair McMillan
  • 1,160
  • 10
  • 23
Blessing Lopes
  • 570
  • 1
  • 5
  • 11
10

Apple has added System Integrity Protection (SIP) to increase security. This means that Jekyll has been effected as it uses the default Ruby install. More details on SIP.

To get around this other users have been installing the Homebrew version. It's also likely that Jekyll v3.0 will start to move towards using this version too.

  • 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
    
thatuxguy
  • 2,418
  • 7
  • 30
  • 51
  • +1 for the SIP link. @blessing answer is what actually did the trick for me: `sudo gem install -n /usr/local/bin/ jekyll` – cregox Dec 28 '15 at 10:13
  • Thanks for the suggestion for trying to install the latest version of Ruby for using Jekyll, it wasn't working for me with a slightly older version of Ruby before, now it works! Massive thanks! – Kris Stern Feb 28 '20 at 14:40
1

Don't install Jekyll with Homebrew, The security of Homebrew is unknown : https://security.stackexchange.com/questions/105088/osx-homebrew-security-risks

Here is how you install it without homeBrew: with a vanilla OSX el cap: http://digitalshore.io/how-to-install-jekyll-mac-os-x-el-capitan/

Update 1:

The only drawback is that you have to type in your password everytime you use sudo, which isnt a big deal. I rather do that than install more dependencies. You should host your Jekyll config on github anyway, that way you wont have to deal with the command line at all. Here is my article on how to set Jekyll up with github: http://stylekit.org/blog/2016/01/06/The-Jekyll-Setup/

Update 2:

Since then i've made a 30 second video tutorial on how you can setup a jekyll blog on github: https://vimeo.com/154566844

Community
  • 1
  • 1
Sentry.co
  • 5,355
  • 43
  • 38
0

It seems this was an OS specific issue. I found a similar issue here, and the answer I found here helped solve the problem : Cannot install cocoa pods after uninstalling, results in error

Community
  • 1
  • 1
lenignes
  • 333
  • 1
  • 5
  • 17
0

I ran into the same error message.

Solved for me by installing ruby from brew.

0
sudo nvram boot-args="rootless=0"; sudo reboot
reboot
sudo gem install jekyll -V
cd into directory
jekyll serve --watch
Koen Peters
  • 12,798
  • 6
  • 36
  • 59
jkw
  • 1
  • 2
    Good answers *explain* as well as provide code. Consider updating your answer to include an explanation about how this code works and why it is the best option. – Ajean Oct 12 '15 at 19:27
  • Disabling SIP just for Jekyll might be a little excessive. – Ian Howson Jul 25 '16 at 23:27
0

The new El Capitan version of OS X has a new technology called SIP that won't let users (even when using sudo) write to the /usr/bin folder. This breaks the install process. You can disable SIP, but I'd prefer to keep it on since it provides protection against bad stuff.

SIP does allow writing in the /usr/local folder so what I did was manually install ruby there using brew and then install jekyll. That worked fine.

sudo brew install ruby
Community
  • 1
  • 1
Koen Peters
  • 12,798
  • 6
  • 36
  • 59
0

If you cannot get it to work you can always try Cloud9.

Cloud9 offers a full development environment in the cloud (running Linux). Their IDE is also quite good and their environments are also very useful for collaboration. Setting up Git is really simple (using the 'git clone' command). With Cloud9 you will be able to work from any computer with a browser, without installing anything.

  1. create a free account on Cloud9 (https://c9.io)
  2. create an empty project (Ubuntu) and follow these steps:
  3. type on the command line: gem install jekyll
  4. create an empty _config.yml file in the root
  5. create a index.md file in the root
  6. type on the command line: jekyll serve --host $IP --port $PORT --baseurl ''
  7. your website is now running 'locally' on Cloud9

The content of your index.md file:

---
title: Home
---

Hello world!

With Cloud9 you can develop on Linux and feel like a pro. Try it! You will love it.

Mr. Hugo
  • 11,887
  • 3
  • 42
  • 60
-3

Try :

 sudo su

Enter your password, try again as root gem install jekyll

Krypte
  • 45
  • 8