When using a Ruby that is installed system-wide (i.e., only writable as root), it is impossible to install linecache19 without becoming root. For example (the 1.9.1 you see all over the place is a quirk of Debian. It's actually Ruby 1.9.3):
[matijs@apricot] gem1.9.1 install --user-install linecache19
WARNING: You don't have /home/matijs/.gem/ruby/1.9.1/bin in your PATH,
gem executables will not run.
Building native extensions. This could take a while...
ERROR: Error installing linecache19:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
checking for vm_core.h... no
/home/matijs/.gem/ruby/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:39: Use RbConfig instead of obsolete and deprecated Config.
checking for vm_core.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9.1
--with-ruby-dir
--without-ruby-dir
--with-ruby-include
--without-ruby-include=${ruby-dir}/include
--with-ruby-lib
--without-ruby-lib=${ruby-dir}/lib
/usr/lib/ruby/1.9.1/fileutils.rb:247:in `mkdir': Permission denied - /usr/include/ruby-1.9.1/ruby-1.9.3-p0 (Errno::EACCES)
from /usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
from /usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `each'
from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
from /home/matijs/.gem/ruby/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:59:in `block in create_makefile_with_core'
from /usr/lib/ruby/1.9.1/tempfile.rb:316:in `open'
from /home/matijs/.gem/ruby/1.9.1/gems/ruby_core_source-0.1.5/lib/ruby_core_source.rb:51:in `create_makefile_with_core'
from extconf.rb:19:in `<main>'
Requesting http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
Downloading http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
Gem files will remain installed in /home/matijs/.gem/ruby/1.9.1/gems/linecache19-0.5.12 for inspection.
Results logged to /home/matijs/.gem/ruby/1.9.1/gems/linecache19-0.5.12/ext/trace_nums/gem_make.out
When using a Ruby that is installed system-wide (i.e., only writable as root), it is impossible to install linecache19 without becoming root. For example (the 1.9.1 you see all over the place is a quirk of Debian. It's actually Ruby 1.9.3):