0

I'm trying to install the Middleman gem on a completely generic installation of Ubuntu Trusty (i386). Here's my console input/output:

vagrant@vagrant-ubuntu-trusty-32:~/rj$ which ruby
/usr/bin/ruby
vagrant@vagrant-ubuntu-trusty-32:~/rj$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [i686-linux]
vagrant@vagrant-ubuntu-trusty-32:~/rj$ gem install middleman
Fetching: bundler-1.7.7.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems

As you can see, I'm using a Vagrant VM after getting similar errors on my host system. (Another answer to someone else's previous question had pointed me toward both Vagrant and Docker, each of which has given output like the lines above.) Interestingly, even using sudo gem install middleman gives me problems.

(I thought about pasting that output here, and I still might if someone asks, but to be honest, I'd rather avoid installing external gems as root if possible, preferring to focus on the errors above. The whole point of middleman, after all, is to create a defined set of flat outputs, limiting the need for privileges and customizations.)

Has anyone encountered errors like this before?

======================

EDIT: By request, here's the output when I use sudo gem install middleman:

Fetching: bundler-1.7.7.gem (100%)
Fetching: rack-1.5.2.gem (100%)
Fetching: tilt-1.4.1.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: uber-0.0.11.gem (100%)
Fetching: hooks-0.4.0.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: thor-0.19.1.gem (100%)
Fetching: i18n-0.6.11.gem (100%)
Fetching: json-1.8.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing middleman:
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>'

Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.8.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
  • What is the error you get when you use sudo? – Peter Dec 2 '14 at 12:30
  • Thanks for your question, Peter. I have added the output above in response to your request. – Patrick Dec 2 '14 at 12:36
  • 1
    Looks like you're missing some kind of dependency. Perhaps start off with an apt-get install of ruby-dev – Peter Dec 2 '14 at 12:46
1

It sounds like you need to run this gem install with sudo as it is using a restricted system folder.

ERROR: While executing gem ... (Errno::EACCES) Permission denied - /var/lib/gems

Try doing this:

sudo gem install middleman

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.