Homebrew上安装Octave

本文介绍如何通过Homebrew在MacOS上安装科学计算软件Octave。首先需要安装Xcode和Homebrew,然后更新Homebrew并安装gfortran依赖。最后安装Octave,并解决可能出现的权限问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

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:

  • Install Xcode via the Mac App Store.
    • For Mac OS 10.9 (Mavericks) install the command line tools by xcode-select --install.
    • For earlier versions of Mac OS, install the command line tools from Xcode's Apple Menu > Preferences > Downloads.
  • Follow Homebrew's installation instructions.
  • If running Mountain Lion (Mac OS 10.8) or later, install XQuartz.

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.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值