Course:MATH307/Octave Installation Instructions

From UBC Wiki
  • Windows

Install the Java runtime environment (optional): If you want a complete version of Octave installed on your computer, and don't have a JRE installed, you should first install one from http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html . But I think this is only needed if you are linking java programs to your octave code ... something that will never come up in our class!

Install Octave: Go to http://www.gnu.org/software/octave , click on Download and choose the link under Windows. Or go directly to https://ftp.gnu.org/gnu/octave/windows . Download the file octave-4.0.0_0-installer.exe and run it. 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.

Octave1.jpg

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

Octave3.jpg


  • 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 thoroughly tested; however, installation works) 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 [Gnuplot.app]/Contents/Resources/bin/gnuplot (replace [Gnuplot.app] by the path of the Gnuplot application -- if you put it in the standard location, this should be /Applications/Gnuplot.app) in a text editor and change the lines
   #  DYLD_FRAMEWORK_PATH="${ROOT}/lib:${DYLD_FRAMEWORK_PATH}" \
   #    open "${ROOT}/lib/AquaTerm.app"

into

     DYLD_FRAMEWORK_PATH="${ROOT}/lib:${DYLD_FRAMEWORK_PATH}" \
       open "${ROOT}/lib/AquaTerm.app"
       

(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.