Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Build a Blog with Jekyll and GitHub Pages Getting Started with Jekyll Installing Jekyll

Can't install jekyll on mac OS X El Capitan. Terminal throws this: ERROR: While executing gem ... (Errno::EPERM)

I ran the terminal command "sudo gem install jekyll" and get the following error:

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

What should I do?

Hello, I am following the tutorial exactly as to how to download jekyll. But my problem is that I get a different error message that the error of not having access to the file.

This is the what I get when I try to install jekyll:

Kathelyns-MacBook-Pro:~ katezelaya$ gem install jekyll ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /usr/local/lib/ruby/gems/2.3.0/gems/jekyll-3.2.1/.rubocop.yml Kathelyns-MacBook-Pro:~ katezelaya$

How do I fix this error and what does it mean? I am pretty sure I installed everything I need to.

In case this information helps, ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14], is the ruby i have on my computer.

Thanks.

5 Answers

I had no permission to the certain folders gem install jekyll was looking for, because this certain ruby folder didn't exist. So I installed ruby 2.2.3 and than I was able to install jekyll.

I'm not seeing that version, I see the 2.3.1 and the 2.2.5, so can you send me the link to the 2.2.3 or was it a typo because I'm having similar issues and I'm downloading the 2.1.9 version.

Thanks in advance

Daniel Aberle
Daniel Aberle
14,629 Points

In your terminal window, proceed by entering in this line...

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

That worked for me.

rydavim
rydavim
18,813 Points

My guess is that this has to do with El Capitan's new Systems Integrity Protection.

Basically, El Capitan nerfed root access, which in turn gummed up stuff for developers. I ended up doing some research and the following steps fixed my problems with El Capitan's Systems Integrity Protection.

Disable Systems Integrity Protection:

  1. Reboot holding Cmd + R to get into recovery mode.
  2. Bring up a terminal from the dropdown menu.
  3. Run csrutil disable to disable Systems Integrity Protection.
  4. Reboot as normal and log back into OSX.

Great! Now you can go about fixing your permissions.

sudo chflags norestricted /usr/local && sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local

That will fix your permissions back to what most developer utilities are expecting. It should also let you make modifications even if you turn Systems Integrity Protection back on.

You may also need to re-install the xcode developer tools.

xcode-select --install

If you want to, you can now reboot into recovery mode again and turn Systems Integrity Protection back on.

Hi rydavim,

I get the following: "syntax error near unexpected token `&'" when I try to fix the permissions with "sudo chflags norestricted /usr/local && sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local".

I have unfortunately no clue why.

Thanks for helping out! :)

markdown took away the amp; after the &...

rydavim
rydavim
18,813 Points

The code was being incorrectly displayed in my original answer. I unfortunately hadn't double-checked, as you had marked your own answer as solving your problem. If you're still having trouble, please use the command with the normal & character. Sorry about that.

I had a similar issue and I had to unstall the 3.2.1 version using my CMD. And then install jekyll 3.1.6 using my CMD. Plus make sure your CMD is on admin, I got on admin on my Windows computer by right clicking on thr Ruby CMD and clicking on admin and it gave me admin access to my Ruby CMD.

Sam Donald
Sam Donald
36,305 Points

I just installed Jekyll (and was having same issue as OP).

The problem is MacOS 10.11 and newer implementation of System Integrity Protection restricts access to the default RubyGem directory, so we don't ruin things.

To fix

Try without sudo first, but in my experience you'll need it.

You can implement Daniel Aberle's solution,

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

But if you include bundler, like so

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

You'll be able to create new Jekyll sites as per the quick-start instructions.

~ $ jekyll new my-awesome-site
~ $ cd my-awsome-site
~/my-awsome-site $ bundle exec jekyll serve

Then open localhost:4000 in your browser to see your new site.