Course:MATH307/Octave Installation Instructions

From UBC Wiki
Jump to: navigation, search
  • Windows

Install the Visual C++ runtime libraries: Download the file vcredist_x86.exe at . This an executable file that you can run by double clicking on the name once it has downloaded. This will install the libraries.

Install Octave: Download the file octave-3.6.2-vs2010-setup.exe at . It is the last .exe file on the list. Run the downloaded file to install Octave. During the installation it will ask for your processor type (you may choose "generic") and what to use for plots (try "gnuplot"). After the installation completes you should have an Octave icon on your desktop that you can click to launch an Octave window. Try it! You should see something like this.


You can test your graphics installation by typing plot([1 2 1]) at the octave prompt. This should produce a new window containing a graph.

Install an editor: Since Octave runs in a command line window with no mouse support (turning your shiny new computer into a circa 1987 PC) you will want to start using m files as soon as possible. This requires a suitable editor like Notepad++. Notepad++ is available for free at . You can use other programming editors (i.e., editors that don't add formatting characters) too.

Tell Octave to use your editor: Open the file C:\Program Files\Octave-3.6.2\share\octave\site\m\startup\octaverc in Notepad++ (or your programming editor of choice). The contents of this file should look like this:

## System-wide startup file for Octave.
## This file should contain any commands that should be executed each
## time Octave starts for every user at this site.

Append the following lines

edit editor "C:\\Program Files\\Notepad++\\notepad++.exe %s"; 
edit mode async;

(notice the double backslashes) and save the file. Of course, if you are using a different editor you should substitute the path to its executable file. To test the editor installation, open a new Octave window and type "edit" at the prompt.

  • Mac

Here is the Octave wiki with installation instructions for Macs. As outlined in the wiki, there are 2 options for installation: building and compiling Octave manually from source; or using a package manager to build and compile source for you. In either case you must have XCode installed.

Building Octave Manually From Source

The Octave wiki indicates that the Octave source can be downloaded and compiled manually, though several dependent libraries also need to be installed. At this time this has not been tested. Please fill out this section if you try it.

Using A Package Manager to Install Octave

There are three package managers listed in the Octave wiki: Fink, MacPorts, and Homebrew. To install Fink or Macports you can download binary *.dmg installer files from their associated websites. Homebrew (not tested) installation involves running a ruby command from terminal to get source from a git repository.

Once your package manager is installed you can install Octave in one command, specific to your package manager. For example, the command for MacPorts is:

 sudo port install octave-devel 

Installation on a 1.8 GHz Core 2 Duo MBA took around 1 hour and used 100% cpu during code compilations.

Additional Information
  • If you are running Snow Leopard (OS X 10.6) or Leopard (OS X 10.5.8) then you may need to manually patch one or two files in the Octave and Gnuplot applications. The instructions may be found here.
  • If your graphics are not working (e.g. plots aren't showing up), make sure you have Gnuplot installed. If Gnuplot is installed, try restarting the computer. If restarting didn't solve the problem, you may have a small problem with Gnuplot. Then check the following:
-Make sure that the environment variable GNUTERM is set to aqua when you run Octave. This can be done by creating a text file called .octaverc in your home directory (not the present working directory) and putting the line setenv ("GNUTERM", "aqua") in it.
-If, when you plot, nothing happens -- no output or errors -- then the problem may be that Gnuplot is not correctly opening a program called AquaTerm which is included in Gnuplot and which Gnuplot uses for displaying graphics. In this case, try opening []/Contents/Resources/bin/gnuplot (replace [] by the path of the Gnuplot application -- if you put it in the standard location, this should be /Applications/ in a text editor and change the lines
   #    open "${ROOT}/lib/"


       open "${ROOT}/lib/"

(i.e. uncomment those lines) and see if it works.

  • Linux

Most Linux distributions include Octave. If it is not already installed on your system you can install the Octave package from your installation CDs or the Internet. To start the Octave interpreter under Linux type ’octave’ in a terminal window.