Octave for macOS: Difference between revisions

2,259 bytes removed ,  9 March 2019
Update Homebrew install instructions, removing references to obsolete X11, removed options, and out-of-support macOS versions
(Reflect "OS X" rename to "macOS")
(Update Homebrew install instructions, removing references to obsolete X11, removed options, and out-of-support macOS versions)
Line 126: Line 126:
First, install Homebrew:
First, install Homebrew:
*Install Xcode via the Mac App Store.
*Install Xcode via the Mac App Store.
** For Mac OS X 10.9 (Mavericks) and newer, install the command line tools by {{Codeline|xcode-select --install}}.
** Install the command line tools by {{Codeline|xcode-select --install}}.
** For earlier versions of Mac OS X, install the command line tools from Xcode's Apple Menu > Preferences > Downloads.
*Follow [https://brew.sh/ Homebrew's installation instructions].
*Follow [https://github.com/mxcl/homebrew/wiki/installation Homebrew's installation instructions].
* If running Mountain Lion (Mac OS X 10.8) or later, install [https://xquartz.macosforge.org/landing/ XQuartz].


To install Octave, update to the latest package definitions, install {{Codeline|gfortran}} (Now you don't need to install it manually, it would be installed by dependency), and then Octave.
To install Octave, update to the latest package definitions with {{Codeline|brew update}}, and then install Octave.


First we ensure brew itself has the latest definitions:
First we ensure brew itself has the latest definitions:
<pre>brew update</pre>
<pre>brew update</pre>


Then, we install Octave. To install only the command-line version use:
Then, we install Octave:
<pre>brew install octave</pre>
<pre>brew install octave</pre>


To install Octave with the Qt GUI, install qt then install Octave --with-qt:
The default charting package in Octave is straight qt. However, on the Mac gnuplot often works better. To switch to gnuplot, place the following text in your ~/.octaverc file:
<pre>brew install qt
brew install octave --with-qt</pre>
 
This would install octave with the default dependencies.
Note: QT may ask you to upgrade your OS (I was running 10.10 and had to upgrade to 10.14 to get it to work)
Note: The second command above also asked me to upgrade XCode to 10, which takes some time (>5GB file)
 
The default charting package in Octave is straight qt. However, on the Mac gnuplot often works better. To set up gnuplot, install (or reinstall) it with qt enabled:
<pre>brew install gnuplot --with-qt</pre>
 
Then configure Octave to use it by placing the following text in your ~/.octaverc file:
<pre>setenv('GNUTERM','qt')
<pre>setenv('GNUTERM','qt')
graphics_toolkit("gnuplot")</pre>
graphics_toolkit("gnuplot")</pre>
Line 170: Line 157:
Note: If brew complains about not having a formula for octave, the following command should fix it:
Note: If brew complains about not having a formula for octave, the following command should fix it:
<pre>brew tap --repair</pre>
<pre>brew tap --repair</pre>
Note: If brew complains about unknown or ambiguous terminal type, and its possible you have installed gnuplot before, try running:
<pre>brew reinstall gnuplot --with-qt</pre>


The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
Line 180: Line 163:
Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours, but precompiled binary packages called 'bottles' are available with default options for Octave and many of its dependencies.
Octave has many dependencies which will be downloaded and installed prior to Octave. The entire installation process can take a few hours, but precompiled binary packages called 'bottles' are available with default options for Octave and many of its dependencies.


Octave has an experimental built-in GUI (developed using Qt lib) installed by default so that gnuplot and other tools could use it directly. Gnuplot will build with Qt support if Octave's Qt-based GUI is enabled. You do not need to install an X server in most situations.
Octave has a built-in GUI (developed using Qt lib) installed by default so that gnuplot and other tools can use it directly. This GUI is always installed when installing Octave using Homebrew.
 
Note: For older versions of OS X (e.g. Snow Leopard), Octave requires an X server. If you install without, Homebrew will guide you to the XQuartz project (https://xquartz.macosforge.org) where you can download this.
 
You might find that you need to add:
 
<pre>setenv ("GNUTERM", "X11")</pre>
 
to your octaverc file, normally located at {{Codeline|/usr/local/share/octave/site/m/startup}}. See also {{Codeline|brew info octave}} for recommended settings.
 
In case of trouble, see the [https://github.com/mxcl/homebrew/wiki/troubleshooting Homebrew Troubleshooting Guide], which assists in diagnosing problems and craft useful bug reports.  The [http://jatinganhotra.com/blog/2014/01/21/installing-octave-on-os-x-10-dot-9-mavericks/ post by Jatin Ganhotra] may also be helpful. Bugs may be reported at [https://github.com/Homebrew/homebrew-science/issues?state=open Homebrew-science's issue tracker].
 
====Using Aquaterm with Gnuplot====
When using {{Codeline|gnuplot}} as the graphics toolkit, if the {{Codeline|aqua}} terminal is not supported by {{Codeline|gnuplot}}, follow the steps below to resolve the problem.


*Uninstall {{Codeline|gnuplot}}
In case of trouble, see the [https://docs.brew.sh/Troubleshooting Homebrew Troubleshooting Guide], which assists in diagnosing problems and craft useful bug reports. Bugs may be reported at [https://github.com/Homebrew/homebrew-core/issues Homebrew-core's issue tracker].
<pre>brew uninstall gnuplot</pre>
*Install [http://aquaterm.sourceforge.net Aquaterm]
*Install {{Codeline|gnuplot}}
<pre>brew install gnuplot --with-aquaterm --with-qt</pre>


==Create a launcher app with AppleScript==
==Create a launcher app with AppleScript==
21

edits