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?
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.
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
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
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
I ran into the same error message.
Solved for me by installing ruby from brew.
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
sudo nvram boot-args="rootless=0"; sudo reboot
reboot
sudo gem install jekyll -V
cd into directory
jekyll serve --watch
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.
create a free account on Cloud9 (https://c9.io)
create an empty project (Ubuntu) and follow these steps:
type on the command line: gem install jekyll
create an empty _config.yml file in the root
create a index.md file in the root
type on the command line: jekyll serve --host $IP --port $PORT --baseurl ''
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.
Try :
sudo su
Enter your password, try again as root gem install jekyll
Related
I was trying to install sass in one of my latest static website project, But got up with a few errors like FAILED TO BUILD GEM NATIVE EXTENSIONS. Its been 5 years I used sass last time, that time it was quite easy by simply adding gem install sass, But I found its difficult.
I have read a few articles and there its saying to install brew, RVM etc etc. I use MACOS. How can I solve my problem from scratch? What should I install and where to install (root / inside project folder).
ruby-sass has been deprecated, and it's recommended that you use another installation method.
https://sass-lang.com/install
I recommend installing via brew (which is a package manager for OS X) since you're on OS X.
https://brew.sh/
To install Brew, open your terminal and paste this:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once the install completes, enter the following command:
brew install sass/sass/sass
I have updated to OSX 10.11 (GM) and have gone to work on some Jekyll projects. However when i try to serve the jekyll site i am getting the following error:-
-bash: jekyll: command not found
Alans-MacBook:new-site alan$
I have been looking around to see if there is a solution, but have yet to find one that can help.
I was wondering if anyone has also ran into this, and if there is a solution.
So i worked out what the actual issue was!
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
Recently I tried to do pod setup and I get this error:
-bash: /usr/local/bin/pod: /usr/local/opt/ruby/bin/ruby: bad interpreter: No such file or directory
I followed Ray Wenderlich's guide to install CocoaPods and I get this issue so I have no idea what is going on.
I encountered this problem when upgrading to Mac OS High Sierra.
This was my fix:
sudo gem install cocoapods
I found this answer on the CocoaPods issue list on Github.
This happened when I upgraded to Catalina.
I solved it by running:
sudo gem install -n /usr/local/bin ruby
sudo gem install -n /usr/local/bin cocoapods
After upgraded to High Sierra, I got the same error, just reinstalled the cocoapods
sudo gem install -n /usr/local/bin cocoapods
Same issue I was facing when I updated our system from Sierra to Mojave. Also works for Catalina
The following steps worked:
sudo gem update --system
sudo gem install -n /usr/local/bin cocoapods
I got the help from the following link.
brew link --overwrite cocoapods
This line saved my day.
i fixed it by running brew install ruby
The following worked for me:
Select Command Line Tools in XCode.
XCode > Preferences > Locations > Command Line Tools > XCode 11.X.X
In terminal execute:
sudo gem install cocoapods -n /usr/local/bin
https://stackoverflow.com/a/60464653
While I'm trying to install again then I got another error saying that
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
Then I did this and worked fine.
sudo gem uninstall cocoapods
sudo gem install cocoapods
On my mac this solved the problem:
brew uninstall cocoapods
brew install cocoapods
After upgrading from OS X Mojave to OS X Catalina I received this message when running pod init or pod --version:
-bash: /Users/mangolassi/.gem/bin/pod: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: bad interpreter: No such file or directory
I don't like the idea of sudo gem install cocoapods so I have my .cocoapods folder in my user directory and I've modified my .bash_profile to point to it. The error I received was because the version 2.3 was hard coded in this file:
/Users/eric/.gem/bin/pod and Catalina came with 2.6.
It's possible that using sudo install would overwrite this file successfully, and probably does, but I wanted to keep my original setup.
I was able to to just modify the first shebang line of the file /Users/eric/.gem/bin/pod to have a path with 2.6 instead of 2.3 and it worked. The entire change was changing the '3' to a '6' in my chase as the version was still '2'.
for MACOS X Catalina
Tried most of the answers but none worked. If the above doesn't work try Opening Xcode preferences > Locations > selecting Command Line Tools to Xcode. Then install cocoapods
sudo gem install -n /usr/local/bin cocoapods
The error in the original post is due to an improperly configured Ruby environment. You should never use sudo to install gems, no matter how many times you see it as an accepted answer on Stack Overflow.
At a high level, setting up a proper Ruby development environment on a Mac involves six steps:
Install Homebrew (which also installs the prerequisite Apple command line tools)
Install a Ruby manager (such as chruby, rbenv, asdf, RVM) - most of these can be installed with Homebrew
Configure the Ruby manager by adding the appropriate lines to your shell file (~/.bash_profile or ~/.zshrc) - each manager will have instructions for doing this, and this is a typical step that people miss
Restart the terminal (or open a new tab) for the shell changes to take effect - another step that is often overlooked
Install a specific version of Ruby using the Ruby manager
Switch to that version of Ruby using the Ruby manager
My personal preference is chruby with ruby-install. For more details and a script that can automate this whole process, check out my answer here:
https://stackoverflow.com/a/54873916/928191
As the accepted answer mentions, you can also install Ruby with Homebrew, but you also need to make sure to set your PATH in your shell file. Instructions for this are in my answer linked above.
I came across a similar issue when I tried upgrading the cocoa pods version using:
brew upgrade cocoapods
To fix this, cocopaods had to be linked with xcodeproj using the command below:
brew link cocoapods
If the linking fails, then you should be able to link by overwriting the previously existing link as follows:
brew link --overwrite cocoapods
Fixed with
brew upgrade cocoapods
In my case nothing of the above worked. I had ruby 2.3.0 installed and I had to downgrade to 2.0.0:
gem update --system 2.0.0
The "rubyist approved" way of doing this is to install a ruby version manager (rbenv) and install cocoapods through that. Messing with sudo and your rubygems is going to lead to tears.
Find the pod file. Mine was located at usr/local/bin/pod
You'll find that the top line says version 2.3. Edit this file to the correct version number. Save a copy of the original incase you mess it up.
Try your pod related commands again.
Worked for me after days of trying everything.
vi pod
then replace the ruby path 2.3 one to the path which u get by using
which ruby command in terminal
then do pod setup it will work
this worked for me after trying all the listed solutions .
re-installing ruby solving issues on my case (error happen after I upgrade Mac OS to Monterey). it's take a bit of time to reinstall but it worked
I'm trying to install Jekyll, a simple, blog-aware, static site generator. When I attempted to run the terminal command gem install jekyll, I got this error:
I then tried to update my RubyGems, using the command sudo gem update --system. That didn't work. Also, I attempted to install using sudo -s (as admin).
Hopefully, I don't have to re-install Ruby. What a headache that would be!
What version of OS X are you using?
Try this from your shell to install xcode command line tools
xcode-select --install
Then launch xcode and agree to the license. Then try again.
I'm having some trouble installing jekyll. Can't quite figure out how to patch the missing link. I think it's an update to Ruby, but RVM is having trouble installing alternate versions of ruby as well.
Heres the full post:
$ sudo gem install jekyll
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/fast-stemmer-1.0.1/ext/gem_make.out
Does this mean I need to update the version of ruby I'm using via rvm?
Ubuntu
sudo apt-get install ruby-dev
gem install jekyll
Your problem is that either you system doesn't know where make is located at or you don't have it installed. The easiest way to fix this (and probably other issues you'll run into trying to get a ruby system up and running) is to install xcode.
You can get it at http://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12 for lion. Or it came on a CD with your computer for earlier versions.
If you're using Lion, please see comments below for a link to how to install developer tools on Lion.
I had the same error on Ubuntu and this helped me sort it out.
You must have ruby-dev installed
apt-get install ruby-dev
If you installed XCode and command line tools are still missing go to Terminal and
xcode-select --install
it will prompt you to install these tools. After that just follow SrBlanco´s answer. That solved the problem for me.
Good luck.
Need to install "make".
I am using Ubuntu 12.10.
sudo apt-get install make
Should work on any Debian based distro.
Note: this problem also occurs on newer MacBook Pro models that come with Mavericks pre-installed. I updated another post with my own solution that didn't involve Xcode at all. My system had the Xcode developer tools installed when I got the machine.
ERROR: Error installing jekyll: ERROR: Failed to build gem native extension
Install Xcode as mentioned if you don't have it installed already (https://developer.apple.com/xcode/). Plus you need the command line tools.
Open Xcode. Go to Preferences > Downloads > Install Command Line Tools
Installing command line tools for Xcode solved the problem for me on my Mac
xcode-select --install.
sudo apt-get install ruby-dev
sudo gem install jekyll
hope this will help, it works with me.
I had this same exact error when trying to install Jekyll, and the following steps from this link helped me. Just in case anyone else comes across this!
http://davidensinger.com/2013/03/installing-jekyll/
I was facing the same issue in my Fedora 22 setup. I had ruby installed but didn't have ruby-devel. Installing ruby-devel fixed the issue for me.
dnf install -y ruby-devel
For older systems:
yum install -y ruby-devel
I followed this on Ubuntu/Linux Mint
sudo apt install build-essential
sudo apt install ruby-dev
sudo gem install jekyll
An addendum: You can install XCode now from the App Store on Mountain Lion. The process is transparent and pretty fast.
I had the same problems with you.
I use Mac OS X 10.9 develop preview version, and I had installed gcc and Xcode.
But my Xcode version is 4.6.
Then I install the Xcode 5.0
After that I type sudo gem install jekyll in the terminal again. Then it works.
Wish it could help someone.
Installing Xcode and going to perferencs > downloads > install commandline tools WORKS!
Same problem on Debian, I had forgot to run this command:
~/.rvm/scripts/rvm
All these answers did NOT work for me.
If you're looking for a solution on ubuntu 14.04, do this:
sudo apt-get install ruby1.9.1-dev zlib1g-dev nodejs
sudo gem install jekyll -v 2.5.3
Unfortunately, nodejs is required because of a bug in Jekyll that enforces existence of runtime JS engine even though it doesn't need one.
For Ubuntu, this helped in my case:
apt-get install libffi-dev
A general advice is to just follow what is displayed as the reason for the error and hopefully you'll be provided with a log file in which the first line suggests which package should be installed, in my case:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/ffi-1.9.21/mkmf.log
MacOS
my solution to this problem
install xcode
type xcode-select --install in the command line
type sudo gem install jekyll in the command line
PS: It is the combination of the two answers in this question.
You are missing the ruby-dev file , just go ahead and run this command - sudo apt-get install ruby-dev
Hope this helps!!
I had the same issue on my macOS(10.14.2), the reason may be:
Apparently with OSX el Capitan, there is a new security function that prevents you from modifying system files called Rootless.
My solution is using rvm:
install ruby on Mac OS X with RVM
gem install jekyll
On windows I have this issue
I actually installed the version rubyinstaller-devkit-2.6.3-1-x64 of ruby
I have removed the ruby completely and Installed the rubyinstaller-devkit-2.5.5-1-x64
and issued the following commands on powershell
gem install bundler
gem install jekyll
and this time no errors where found
I had this issue and of all things, the error was occurring because I hadn't agreed to some updated terms of service in xcode. Running the following did the trick for me. Go figure.
sudo xcodebuild -license accept
For me, I had to upgrade homebrew and install rbenv to the latest ruby version. After that, I followed the instruction at jekyll website. My OS is Catalina 2019, I couldn't install Xcode, which is not compatible yet!
You have to set the path in your .bash_profile to make sure that it initializes the rbenv when you restart your terminal.
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
then
$ rbenv version
2.2.3 (set by /Users/mislav/.rbenv/version)
$ rbenv shell
rbenv: no shell-specific version configured
hope that help!
Here is the (only?) reliable and simple way to install Jekyll on macOS
Install UTM
Install Ubuntu Server
Install Jekyll using Ubuntu instructions at https://jekyllrb.com/docs/installation/ubuntu/
Forward port 22 in the VM settings (22->localhost->22)
Use VS Code on the macOS host
Install Remote SSH
Connect to USER#localhost
Drag and drop the folder on Mac into VS Code (this transfers files to remote)
Enable port forwarding for 4000 (bottom bar on VS Code)
Work on your website
Right click on your website on the file explorer and click download
If you have not done these steps, you might be delighted by:
Ubuntu imports your public SSH key from GitHub
VS Code magically handles file transfer in and out
VS Code magically installs your VS Code extensions onto the remote server and allows file search on the remote host