Failed to build gem native extension when install RedCloth-4.2.9 install Linux

thlgood picture thlgood · Aug 25, 2012 · Viewed 18.2k times · Source

I want to install Octopress in my computer. I try to do it like

Octopress document.

When I run

bundle install

I got error message

An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

So, I run

sudo gem install RedCloth -v '4.2.9'

then, I got a error message again:

ERROR:  Error installing RedCloth:
ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9.1 extconf.rb
    /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'

I hadn't learn any knowledge about ruby.

Answer

Eric Zhang picture Eric Zhang · Jan 16, 2013

My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.

sudo apt-get install ruby1.9.1-full

you can execute command:

sudo update-alternatives --config ruby

to select the altiernative ruby which you have installed. and then, execute below commands to finish the octopress deploy:

git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install

below commands you can find from octopress deploy guideline page:

rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy

Hope it's helpful for you, thanks