Install packages in GNU Octave

1 minute read

GNU Octave can install packages in a friendly way, analogous to the Matlab App Store or how Linux repositories work. Regardless of operating system, Octave can install these extension packages from the Octave command line.

Install GNU Octave

  • Linux: apt install octave liboctave-dev
  • Mac: brew install octave
  • Windows installer
  • BSD: pkg install octave

Install Packages

Some packages require a compiler or libraries, though most do not. It’s rarely an issue, though please comment if you do run into a problem and aren’t finding a solution.

Packages are installed at the Octave command prompt, and download automatically. Prereqs are not automatically installed, but messages are given telling which package needs to be installed first. signal is a perfect example of this, given below.


A very popular package is the signal package, which brings many functions found in Matlab’s DSP and Communications Toolbox. We’ll see that signal needs other packages first; let’s walk through the Octave signal install. All commands are from Octave command prompt.

  1. Try using a command that requires signal

    warning: the ‘diric’ function belongs to the signal package from Octave Forge which seems to not be installed in your system.

    • if I had already installed signal, but forgotten to load it since I started Octave, the error would have been:

    warning: the ‘diric’ function belongs to the signal package from Octave Forge which you have installed but not loaded.

  2. OK, so let’s try to install signal
    pkg install -forge signal
    use the Octave-Forge repo for automatic download.

    This returns a warning saying that control is required.

  3. Install control:
    pkg install -forge control

    this requires the gfortran compiler. If you get a message saying you need gfortran:

    • Linux: apt install gfortran
    • Mac: brew install gcc
    • BSD: pkg install gcc
    • Windows installer
  4. now signal will install:
    pkg install -forge signal

Using packages

You can use Octave packages in a Matlab-compatible way simply by enclosing in try end

function d = twicediric(x)
    pkg load signal
  d = 2*diric(x)

If the package isn’t installed for someone’s Octave, they’ll get the error message on reaching the missing function telling them which package they need to install.

Leave a Comment