Werden wir Helden für einen Tag

Home | About | Archive

Install binary version of Octave for Mac OS X

Posted on Oct 15, 2011 by Chung-hong Chan

Octave 是 FOSS 版本的 MATLAB 。 ((其實我好憎 MATLAB ,今天才在 Google Plus 臭罵 MATLAB ,內容如下:The syntax of Octave or his non-opensource brother MATLAB is a chaos. For example, some functions work like "load something.dat" and in some case you need "load(something.dat)". It is not consistent and this inconsistency is idiosyncratic. Maybe mathematicians or engineers could appreciate it but I just can't. LISP/Scheme is a great thing because of it's consistency. I like R for it's LISPy consistency.)) 由於 Machine Learning 要用到它,故此將它裝至 Macbook 。在工作間的 Linux 電腦可用一個指令安裝好

sudo apt-get install octave gnuplot

但在 Mac OS X ,卻好煩。其實在 Octave 主頁是有 Binary 下載,叫做 Octave.app 。但是安裝完卻要在 Application 雙擊開啟,才彈出 Terminal 運行 Octave 。與 Binary 的 R 不相像 ((安裝完 Mac 版的 R binary ,在 Terminal 是可以啟動 R 的。因此,像 emacs 的 ESS 才能工作)) ,在 Terminal 輸入 octave 是不能啟動 octave 的。這一點我是不能理解的。
安裝完 Octave.app 後,要在 Terminal 輸入

sudo ln -s /Applications/Octave.app/Contents/Resources/bin/octave /usr/bin/octave

就可以直接在 Terminal 輸入 octave 啟動。

修好後,才可以用 emacs 正常使用 octave 。如果想要將原來 MATLAB 的 .m 用 Octave mode 開啟,要在 ~/.emacs 加入:

(autoload 'octave-mode "octave-mod" nil t)
(setq auto-mode-alist
(cons '("\\.m$" . octave-mode) auto-mode-alist))

要在 emacs 開個 octave 的 prompt ,叫作 inferior octave ,以 M-x run-octave 啟動。
將 source code 送到 inferior octave , keybinding 好奇怪。 (C-c TAB C-b, WTF?)


Powered by Jekyll and profdr theme