linyang:~ apple$ brew tap homebrew/science
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
adplug atari800 grafana inspircd instead mpw nfdump urh
Error: homebrew/science was deprecated. This tap is now empty as all its formulae were migrated.
(没有管这个错误)
linyang:~ apple$ brew update && brew upgrade
Already up-to-date.
linyang:~ apple$ brew install octave
。。。。。。
如下显示安装成功:
linyang:~ apple$ octave GNU Octave, version 4.2.2 Copyright (C) 2018 John W. Eaton and others. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "x86_64-apple-darwin17.5.0".
Additional information about Octave is available at http://www.octave.org.
Please contribute if you find this software useful. For more information, visit http://www.octave.org/get-involved.html
Read http://www.octave.org/bugs.html to learn how to submit bug reports. For information about changes from previous versions, type 'news'.
octave:1> 5+6 ans = 11
|
链接:http://wiki.octave.org/Octave_for_macOS#Homebrew
Homebrew is a package management system that simplifies the installation of software on Mac OS X. It is a free/open source software project to simplify installation of other free/open source software. It is similar in aim and function to MacPorts and Fink. It was written by Max Howell and has gained popularity in the Ruby on Rails community and earned praise for its extensibility.
First, install Homebrew:
xcode-select --install
.To install Octave, update to the latest package definitions, install gfortran
(Now you don't need to install it manually, it would be installed by dependency), and then Octave:
brew update && brew upgrade
brew install octave
This would install octave with the default dependencies.
Note: If brew complains about:
Linking /usr/local/Cellar/ghostscript/9.14...
Error: Could not symlink share/ghostscript/Resource
/usr/local/share/ghostscript is not writable.
This is telling you the user permissions for ghostscript are not setup in a way that your user profile can use. You need to change those permissions to your user profile. The following command will repair the issue:
sudo chown -R `whoami` /usr/local/share/ghostscript
brew link --overwrite ghostscript
Then run the brew install command again for octave.
Note: If brew complains about not having a formula for octave, the following command should fix it:
brew tap --repair
The command below upgrades Octave and its dependencies to the latest Homebrew-supported versions:
brew update && brew upgrade
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. Note: On 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:
setenv ("GNUTERM", "X11")
to your octaverc file, normally located at /usr/local/share/octave/site/m/startup
. See also brew info octave
for recommended settings.
In case of trouble, see the Homebrew Troubleshooting Guide, which assists in diagnosing problems and craft useful bug reports. The post by Jatin Ganhotra may also be helpful. Bugs may be reported at Homebrew-science's issue tracker.