Just finished installing ubuntu 16.04.1 desktop version. Now I am trying to install m4. So far installed m4 as follows.

  1. Downloaded m4-1.4.18.tar.gz
  2. tar -xvzf m4-1.4.18.tar.gz
  3. cd m4-1.4.18
  4. ./configure --prefix=/usr/local/m4
  5. make
  6. sudo make install

Now when I type:

m4 --version

It still says:

The program 'm4' is currently not installed....

What step am I missing?

Note: I do not have internet access on this machine.


Normally on Ubuntu you'd just do apt-get install m4 to install m4 (which assumes you have an Internet connection), or download the m4 package and copy it across.

The way you've gone about things, m4 has been installed in /usr/local/m4/bin, so you need to run /usr/local/m4/bin/m4 or add /usr/local/m4/bin to your PATH. Alternatively, you can re-install, using

./configure && make && sudo make install

which will install m4 to /usr/local/bin, which should already be on your PATH.

  • Thanks, running PATH=$PATH:/usr/local/m4/bin did it! Am I going about this the right way? Seems manually downloading the *.tar.gz file is not the right way? I see the update. How would I uninstall it first correctly? – arod2028 Jan 10 '17 at 14:31
  • Manually downloading the tarball isn't the best way, no, but it's not wrong either. sudo make uninstall in your current source tree will uninstall m4, or you can simply delete /usr/local/m4. – Stephen Kitt Jan 10 '17 at 14:36
  • Thanks that worked perfect. I think I am back on track now. Much appreciated Steve. – arod2028 Jan 10 '17 at 14:39
  • I would avoid using /usr/local at all if it's used by a package manager. Much safer to use e.g. /opt or /sw or $HOME/local. See also GNU Stow. – Kusalananda Jan 10 '17 at 16:11
  • @Kusalananda /usr/local is never used by a package manager. The whole point of /usr/local is to install local software; that's why ./configure defaults to /usr/local as prefix. – Stephen Kitt Jan 10 '17 at 16:12

You may also need install these

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib 
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386 
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential  
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib 
sudo apt-get install libc6-dev-i386 
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev 
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache
  • 1
    Why on earth would the m4 utility need all of that? – Kusalananda Sep 10 '18 at 14:52
  • @Kusalananda I really don't know why m4 is needed, i just install all this packages then it worked. – i love jack Nov 19 '18 at 5:48
  • The user wants to use m4. One of those packages is the m4 package, the rest is just random. – Kusalananda Nov 19 '18 at 7:13

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.