How to Install Gnuplot on Ubuntu and Debian

On Ubuntu and Debian, gnuplot is one apt command away: run sudo apt update && sudo apt install gnuplot, then check gnuplot --version. The trade-off is version freshness — distribution repositories often ship an older gnuplot than the current 6.0.5 release.

Step-by-Step Installation

  1. Update the package index:
    sudo apt update
  2. Install gnuplot:
    sudo apt install gnuplot

    apt pulls in the gnuplot package plus the Qt terminal package it depends on, so graphical windows work out of the box.

  3. Verify:
    gnuplot --version
  4. Draw a test plot:
    gnuplot
    plot sin(x)

Which Version Will You Get?

Ubuntu and Debian freeze package versions for each of their own releases, so the version apt installs depends on your OS release and may be 5.4.x or an early 6.0 patchlevel rather than 6.0.5. For everyday plotting that is perfectly fine. You only need the newest release if you rely on a 6.0.5 feature (for example the improved multiplot mouse support) or a script that uses new syntax.

Getting the Latest 6.0.5 Instead

  1. Download the source tarball (gnuplot-6.0.5.tar.gz) from the download page.
  2. Unpack it and build:
    tar -xzf gnuplot-6.0.5.tar.gz
    cd gnuplot-6.0.5
    ./configure
    make
    sudo make install
  3. Open a new terminal and confirm gnuplot --version now reports patchlevel 5. You may need development libraries (build-essential and the Qt/libgd development packages) for a full-featured build.

Common Pitfalls

  • Headless server, no plot window: on a server without a desktop, the Qt terminal cannot open a window. Set an output terminal in your script instead, e.g. set terminal pngcairo with set output.
  • Two gnuplots after a source build: the apt build lives in /usr/bin and a source install in /usr/local/bin. Run which gnuplot to see which one your shell picks.

Using a different distribution? See the general Linux installation guide, and run through the verification checklist when you are done.

Back up your plot scripts and data

Your .gp scripts and data files are small but hard to recreate. Keeping a synced backup means a reinstall never costs you your work. pCloud offers cloud storage with a one-time lifetime option and syncs a scripts folder across machines automatically. Affiliate link — see our Affiliate Disclosure.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *