Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

According to the jekyll site, this is how you make a new website with jekyll:

~ $ gem install jekyll
~ $ jekyll new myblog
~ $ cd myblog
~/myblog $ jekyll serve

gem install jekyll didn't work, nor did sudo gem install jekyll:

└─>gem install jekyll
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2/LICENSE
┌─[Sat Jun 08][jon@jon-MacMini:~/Web]
└─>sudo !!
sudo gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
    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/fast-stemmer-1.0.2 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/fast-stemmer-1.0.2/ext/gem_make.out

I also tried following the answer here, but that doesn't help. sudo apt-get install jekyll works. Even then, though, running jekyll new myblog returns this error:

└─>jekyll new myblog
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
WARNING: Could not read configuration. Using defaults (and options).
    No such file or directory - new/_config.yml
Building site: new -> myblog
/usr/lib/ruby/vendor_ruby/jekyll/site.rb:126:in `chdir': No such file or directory - /home/jon/Web/new/ (Errno::ENOENT)
    from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:126:in `read_directories'
    from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:98:in `read'
    from /usr/lib/ruby/vendor_ruby/jekyll/site.rb:38:in `process'
    from /usr/bin/jekyll:250:in `<main>'

Anyone know what's causing this?

share|improve this question
    
Ubuntu 13.04. I installed ruby the usual way: sudo apt-get install ruby. – Jon Jun 9 '13 at 4:24
up vote 42 down vote accepted

On my 13.04 and 14.04 systems, things worked for me after installing the ruby-dev package, then running the gem install:

  • sudo apt-get install ruby1.9.1-dev (or try: ruby-dev instead)

  • gem install jekyll # if this fails then sudo gem install jekyll

After that, jekyll was installed correctly.

Note that for the gem install instruction, it is better not to use sudo.*****

It's better to use something like RVM, so that sudo isn't required. On some systems it may be necessary to use sudo, if for instance permissions were set by previous sudo commands or root-level configuration.

See this stackoverflow question -- how to install gems without sudo for more information and for help on getting permissions set to user instead of root.

***** Credit to @iguarav for this best practices advice as well as the link to rvm.io.

share|improve this answer
1  
That worked. I also had to add the gem directory to my PATH, though, in order to be able to run jekyll from the command-line. I also had to uninstall the ubuntu package version, which doesn't have the new subcommand. – Jon Jun 17 '13 at 14:03
    
This worked for me. Also, I first tried installing and using ruby2.0-dev but without luck. – emchristiansen Jan 21 '14 at 21:24
    
confirmed to work at ubuntu 14.04 – Meta Jul 8 '14 at 14:12
    
you should not use sudo with gem install since these are just reusable libraries – igaurav Jul 31 '14 at 4:10
    
@belacqua best practices recommend usage of RVM rvm.io . if you use sudo excessively , you soon will be facing dependency problems . – igaurav Aug 3 '14 at 12:29

Also, you don't want to depend on sudo for executing gems, so I recommend to add your user to the root's group and:

sudo chmod -R 770 /var/lib/gems
sudo chmod -R 770 /usr/local/bin

Just doing a few updates on this thread. According the jekyll's installation docs the version needed is version 2. After fixing the permissions issue, I ran into that expected error:

ERROR:  Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.

Installing with RVM:

gpg --keyserver hkp://keys.gnupg.net --recv-keys \  409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --ruby             
/bin/bash --login
rvm install 2.3.0
rvm use 2.3.0
rvm rubygems latest
ruby --version
rvm install ruby-dev

For other issues with the Ruby installation, follow this.

After that, it worked for me.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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