Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How do I install gawk 4.0.1 or later on ubuntu 12.04?

Your suggestions would be appreciated!!

share|improve this question

1 Answer 1

up vote 6 down vote accepted

First of all, note the information in the following question:

This is an approach to build the Quantal (12.10) 4.0.1 version of gawk on 12.04 as a package. It applies to almost all packages you want to backport from a newer Ubuntu release to the one you're using. Most of the times it just builds cleanly. This one does.

  1. Install some basic package build tools:

    sudo apt-get install devscripts build-essential
    sudo apt-get build-dep gawk
  2. Install the key of the developer (example key!):

    gpg --keyserver keyserver.ubuntu.com --recv-key B6897E7B

    This key identifier should be replaced by the error output of the dget command below.

  3. Make the devscripts use your keyring too, as per Added key, but dget still shows “gpg: Can't check signature: public key not found":

    echo 'DSCVERIFY_KEYRINGS="/etc/apt/trusted.gpg:~/.gnupg/pubring.gpg"' >> ~/.devscripts
  4. Download the source package (.dsc file link from gawk package page in the sidebar):

    dget http://archive.ubuntu.com/ubuntu/pool/main/g/gawk/gawk_4.0.1+dfsg-2.dsc
  5. cd into it:

    cd gawk-4.0.1+dfsg/
  6. First attempt to build (fails possibly):

    debuild -uc -us

    if fails, relevant output with dpkg-checkbuilddeps: Unmet build dependencies (below is an example!):

    Unmet build dependencies: bison libreadline-dev libsigsegv-dev
  7. Install the additional build dependencies you still need at this point. Example:

    sudo apt-get install bison libreadline-dev libsigsegv-dev
  8. Retry building (should build fine now!):

    debuild -uc -us
  9. cd back into the upper directory:

    cd ..
  10. Find your package there:

    ls -al *.deb
  11. Install it:

    sudo dpkg -i gawk_4.0.1+dfsg-2_amd64.deb
  12. Enjoy!

In case you don't want to bother compiling this stuff, you still have two options:


I've uploaded this on my PPA (waiting to be built at this moment) for your convenience.

Manual installation of Quantal binary package

  1. Download the appropriate .deb file from the packages.ubuntu.com page, e.g. http://nl.archive.ubuntu.com/ubuntu/pool/main/g/gawk/gawk_4.0.1+dfsg-2_amd64.deb

  2. Install it manually:

    sudo dpkg -i gawk_4.0.1+dfsg-2_amd64.deb
share|improve this answer
Great explanation!! Thank you very much!! –  sara Jan 18 '13 at 2:34

Your Answer


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.