Installing MacOS X Bundle: Difference between revisions

From Octave
Jump to navigation Jump to search
No edit summary
(Clean up (could use a review). We'll eventually want to have separate sections for 3.2,x, 3.4.x, 3.6,x, etc.)
Line 1: Line 1:
'''Introduction to the Bundle'''
These install instructions are verified to work for the [http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/ October 04, 2011 binary for Octave 3.4.0], hosted on sourceforge.
Installing Octave on a mac should be a breeze since is there a nice bundle that's easily downloaded and contains everything that you will need .  But there's a lot of new users that run into problems, and for good reason. If you are a mac user and are suddenly faced with installing stuff that requires you to delve into the bowels of your computer for the first time (or even the second or third) - it can be mighty intimidating and success can be illusive.  This writer knows first hand.  So this is largely for those at the low end of the experience spectrum, although there may be some tips that help the power user community if they have need to make Octave work in the mac world.  I hope so, because the things they contribute certainly help me out a lot.
Octave is a numerical computation software platform.  It can calculate just about anything that you can imagine.  But if you want to see the results graphically, you need a plotting system to make that happen.  That's another application called Gnuplot.  Gnuplot takes output from Octave and plots it in windows on your screen - or sends it off to print or whatever you want to do.  This requires a windowing system - (now we're getting a bit closer to the bowels) - and the most common one is X11.  This is installed by default on OS X 10.5 and above.  However many mac users prefer the appearance of another windowing system - Aquaterm.  So this part of the wiki helps you to install Octave and make it plot your results through Gnuplot using the Aquaterm windowing system.  At the end I'll try and deal with some of the issues that arise during installation that might make it seem like 'it just doesn't work'.
'''Let's do it'''
The following is current as of 20120105.  The installation process has been confirmed on an iMac running OS X 10.6.8 that has never previously had octave or gnuplot installed. 
Download this binary  (octave-3.4.0-i386.dmg) at:
http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/  
It's the latest version of octave for which an OS X binary is available.
Mount (double click) the dmg.
Look in the 'Extras' folder and find a gnuplot-4.4.3-aqua-i386.dmg disc image.
This is a nice OS X binary of an up to date version of gnuplot and, ironically, may be the only place such a gnuplot binary exists for OS X. As an added bonus this gnuplot package includes and relies on Aquaterm the windowing system that many Mac users feel produces more elegant plots than X11.  
Mount (double click) this dmg.
Move the 'Gnuplot' icon to your Applications folder. For purpose of this discussion - this is assumed to be /Applications.  If you are using a local Applications folder (/~/Applications) appropriate modification of the paths specified below will be necessary.
At this point, Aquaterm is now also installed. It is located at /Applications/Gnuplot.app/Contents/Resources/lib/Aquaterm.app  If you need it for some other application, this is the path that will find it.  But don't move it to the upper level of the Applications folder - gnuplot will be looking for it where it self-installs.  (To inspect the contents of an .app right click or control-click on it and select 'show package contents')
Move the 'Octave' icon from the first .dmg to the same folder (/Applications).  It is strongly suggested that gnuplot be installed before octave.
Now you have everything you need to run octave+gnuplot+aquaterm.  You can put the octave and gnuplot icons in the dock and either will open in a terminal window with a simple 'click'.  To test octave, click its icon, and the octave prompt should appear in a new terminal window along with some splash screen information.  Then type 'sombrero(24)' at the octave prompt and after a while aquaterm should open and the multicolor sombrero plot should appear.


'''Problems, problems, problems ........'''
= Download the DMG =


If you did all of the above and there is no result, most likely you got the octave prompt, typed the 'sombrero(24)' test, but no plot showed up. You probably got some error message that included the line 'sh: gnuplot: command not found'. This means (surprise, surprise) that octave couldn't find gnuplot in order to pass on the plot information. We can fix that, but it requires some unix magic on the command line. We are going to create 'dummy' applications at a location where OS X will search and be sure to find them. Open a new terminal window (/Applications/Utilities/Terminal)  and do (ignoring the # comments):
The latest MacOS X binary (DMG) available is for Octave-3.4.0. Click on this [http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/ link] to download.


> sudo touch /usr/bin/gnuplot              # creates an empty 'dummy' gnuplot file in directory /usr/bin which is included in most  PATHs. sudo invokes the 'superuser' or administrator and will ask for a password .... then:
Once it has been downloaded, double-click on the dmg to mount the disk image. It is recomended that Gnuplot is installed prior to Octave.


> ln -s  /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot  /usr/bin/gnuplot      #creates a link between the binary in the app in your Applications folder and the new dummy gnuplot file (in the bowels).
= Install Gnuplot & Aquaterm =


> touch /usr/bin/octave    # while we're at it, may as well do the same thing for octave
Look in the 'Extras' folder and find the gnuplot-4.4.3-aqua-i386.dmg disc image.  Double-click this dmg to mount the Gnuplot disk image.


> ln -s /Applications/Octave.app/Contents/Resources/octave  /usr/bin/octave    # this is a good way of inserting octave in your PATH so it can be started from the command line
On this disk is the OS X binary for Gnuplot. The Gnuplot package includes and relies on Aquaterm for displaying plots using [http://en.wikipedia.org/wiki/Quartz_(graphics_layer) Apple's Quartz graphics layer]. Alternatively, X11 can be used. However, the pleasant anti-aliasing features of Quartz will are not included with X11 on MacOS X.


Now to make sure that /usr/bin is in your path do:
Move the 'Gnuplot' icon to your Applications folder. For purpose of this discussion - this is assumed to be /Applications.  If you are using a local Applications folder (/~/Applications) appropriate modification of the paths specified below will be necessary.
 
> env
 
this should produce several lines of text in response including something like :  PATH=/opt/local/bin:/opt/local/sbin:/usr/local:/bin:/sbin:'''/usr/bin:'''/usr/sbin:/usr/texbin:/usr/local/bin  -- check to see that /usr/bin: is included
 
If it is, octave and gnuplot should work fine now.  If not, we need to go to the .bashrc file.  This is a(n invisible) file that sets things that are important to you up every time you open a new terminal window. Type this at the prompt:


> touch .bashrc                  # creates .bashrc file if one doesn't exist;
This Gnuplot application includes Aquaterm. It is located at /Applications/Gnuplot.app/Contents/Resources/lib/Aquaterm.app  If you need it for some other application, this is the path that will find it.  But don't move it to the upper level of the Applications folder, or else Gnuplot will not know where to find it.
> open .bashrc                  # opens it in your editor (probably Textedit)


type this in the editor:
= Install Octave =


PATH=$PATH:/usr/bin;
Move the 'Octave' icon from the first .dmg to the Applications folder (/Applications).
export PATH


save and close
Now you have everything you need to run Octave, Gnuplot, and Aquaterm.  You can put the Octave and Gnuplot icons in the dock and either will open in a terminal window with a simple 'click'.  To test Octave, click its icon, and the Octave prompt should appear in a new terminal window along with some splash screen information.  Then type 'sombrero(24)' at the Octave prompt and after a while aquaterm will open and the multicolor sombrero plot should appear. 


Things should work now ....... Open a new terminal window and type 'octave'  then 'sombrero(24)' at the prompt.
= Running Octave and Gnuplot from a Terminal =
Starting octave from the command line requires these steps to inform bash (your shell) where the octave binary is located. 


'''Some Other Solutions'''
Starting Octave from the command line requires one further step to inform bash (your shell) where the Octave binary is located.  This is accomplished through the bash initialization file ~/.bashrc (the leading "." means it's normally invisible in the finder).  To run Octave and Gnuplot from a terminal, symbolic links will be used.


There are other issues that come up that are largely a function of the way you have your system set up and, perhaps, what remnants of octave/gnuplot/aquaterm/X11 you have floating around in it. Following are things that might help when it just refuses to work.
* Open a new terminal window, and enter the commands below.
** {{Codeline|sudo touch /usr/local/bin/gnuplot}}
** {{Codeline|sudo ln -s /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot /usr/local/bin/gnuplot}}
** {{Codeline|sudo touch /usr/local/bin/octave}}
** {{Codeline|sudo ln -s /Applications/Octave.app/Contents/Resources/octave /usr/local/bin/octave}}
* Test that everything is ok.
** In a Terminal window type the command below.
*** {{Codeline|octave}}
** Octave should now be running. To test Gnuplot / Aquaterm, try a plot.
*** {{Codeline|sombrero ()}}


Open .bashrc and add:
If Octave did not run, check to ensure that your PATH includes /usr/local/bin.
export GNUTERMAPP=/Applications/AquaTerm.app;
export GNUTERM=aqua


save and close
* From the Terminal prompt, type,
** {{Codeline|env}}
* If the PATH does not include /usr/local/bin, type the commands below.
** Open ~/.bashrc in an editor
*** {{Codeline|touch ~/.bashrc}}
*** {{Codeline|open ~/.bashrc}}
** Add the line below to the contents of ~/.bashrc
*** {{Codeline|<nowiki>export PATH=$PATH:/usr/local/bin</nowiki>}}
** Save ~/.bashrc and exit
* If the PATH does include /usr/local/bin, help may be requested by posting to [https://mailman.cae.wisc.edu/listinfo/help-octave Octave's email list]. Please provide a detailed description of what you've tried and what the results were.

Revision as of 15:37, 30 January 2012

These install instructions are verified to work for the October 04, 2011 binary for Octave 3.4.0, hosted on sourceforge.

Download the DMG

The latest MacOS X binary (DMG) available is for Octave-3.4.0. Click on this link to download.

Once it has been downloaded, double-click on the dmg to mount the disk image. It is recomended that Gnuplot is installed prior to Octave.

Install Gnuplot & Aquaterm

Look in the 'Extras' folder and find the gnuplot-4.4.3-aqua-i386.dmg disc image. Double-click this dmg to mount the Gnuplot disk image.

On this disk is the OS X binary for Gnuplot. The Gnuplot package includes and relies on Aquaterm for displaying plots using Apple's Quartz graphics layer. Alternatively, X11 can be used. However, the pleasant anti-aliasing features of Quartz will are not included with X11 on MacOS X.

Move the 'Gnuplot' icon to your Applications folder. For purpose of this discussion - this is assumed to be /Applications. If you are using a local Applications folder (/~/Applications) appropriate modification of the paths specified below will be necessary.

This Gnuplot application includes Aquaterm. It is located at /Applications/Gnuplot.app/Contents/Resources/lib/Aquaterm.app If you need it for some other application, this is the path that will find it. But don't move it to the upper level of the Applications folder, or else Gnuplot will not know where to find it.

Install Octave

Move the 'Octave' icon from the first .dmg to the Applications folder (/Applications).

Now you have everything you need to run Octave, Gnuplot, and Aquaterm. You can put the Octave and Gnuplot icons in the dock and either will open in a terminal window with a simple 'click'. To test Octave, click its icon, and the Octave prompt should appear in a new terminal window along with some splash screen information. Then type 'sombrero(24)' at the Octave prompt and after a while aquaterm will open and the multicolor sombrero plot should appear.

Running Octave and Gnuplot from a Terminal

Starting Octave from the command line requires one further step to inform bash (your shell) where the Octave binary is located. This is accomplished through the bash initialization file ~/.bashrc (the leading "." means it's normally invisible in the finder). To run Octave and Gnuplot from a terminal, symbolic links will be used.

  • Open a new terminal window, and enter the commands below.
    • sudo touch /usr/local/bin/gnuplot
    • sudo ln -s /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot /usr/local/bin/gnuplot
    • sudo touch /usr/local/bin/octave
    • sudo ln -s /Applications/Octave.app/Contents/Resources/octave /usr/local/bin/octave
  • Test that everything is ok.
    • In a Terminal window type the command below.
      • octave
    • Octave should now be running. To test Gnuplot / Aquaterm, try a plot.
      • sombrero ()

If Octave did not run, check to ensure that your PATH includes /usr/local/bin.

  • From the Terminal prompt, type,
    • env
  • If the PATH does not include /usr/local/bin, type the commands below.
    • Open ~/.bashrc in an editor
      • touch ~/.bashrc
      • open ~/.bashrc
    • Add the line below to the contents of ~/.bashrc
      • export PATH=$PATH:/usr/local/bin
    • Save ~/.bashrc and exit
  • If the PATH does include /usr/local/bin, help may be requested by posting to Octave's email list. Please provide a detailed description of what you've tried and what the results were.