installing ruby-pg gem – handling extconf.rb:1:in `require‘: no such file to load — mkmf (LoadError)

Diagnosis: Installing ruby-pg fails when trying to create the native extensions:

florian@PC172:~$ sudo gem install ruby-pg
Building native extensions. This could take a while...
ERROR: Error installing ruby-pg:
ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb install ruby-pg
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:1

Gem files will remain installed in /var/lib/gems/1.8/gems/ruby-pg-0.7.9.2008.01.28 for inspection.
Results logged to /var/lib/gems/1.8/gems/ruby-pg-0.7.9.2008.01.28/ext/gem_make.out

Medicine: install the ruby-dev package – as recommended on RubyForge and on Mentalized by Jakob Skjerning. In some cases, the xxx-dev packages are required for building the native extensions, too- e.g. libsqlite3-dev to install the sqlite3-ruby gem.