35

I recently installed GNU Octave on my Mac using Homebrew and as soon as I typed octave into bash, it opened up the octave-gui window. The Octave GUI looks quite unappealing (on a mac, at least) so I wanted to use the command line interface. My fix was to create a permanent alias in ~/.bash_profile which was alias octave='octave --no-gui'.

Is there a more permanent fix to this? That is, how can I start using octave without invoking the GUI instead of the CLI? Is there a solution where I don't have to do this by using an alias. (Not that using the alias is a big issue, but I just wanted a better fix to starting Octave on the command line itself.)

Miguel
  • 7,497
  • 2
  • 27
  • 46
akad3b
  • 397
  • 1
  • 3
  • 13
  • 1
    I also use an alias and think is the right way if you don't want to compile it yourself. If you want to build Octave there is a configure switch which disables the GUI – Andy Jul 26 '16 at 15:46
  • That's good to know @Andy Is there an octaverc file that I can edit to directly build Octave on the CLI? – akad3b Jul 26 '16 at 15:48
  • btw, can you add a screenshot from the "hideous" GUI on Mac? I now there are many Mac users which really like it. Perhaps it's only a problem on your system? – Andy Jul 26 '16 at 15:52
  • @Andy Hideous was probably too strong an adjective. I think it is unappealing to me since I am trying to get used to working on the terminal. http://imgur.com/a/RAVdW – akad3b Jul 26 '16 at 16:04
  • that ... does look hideous! Why is that?? I have to say, on my linuxbox it looks a lot more very welcoming: [http://i.stack.imgur.com/cTDpe.png](http://i.stack.imgur.com/cTDpe.png) – Tasos Papastylianou Jul 26 '16 at 21:06
  • Though I have to say, I also tend to use the terminal version sometimes, when I just want to test a quickie on my lovely drop-down `guake` terminal. My own solution was that I made a commandline alias as `octavecli` to save me from typing the `--no-gui` option, so I use that for a quick terminal session, and `octave` for the proper graphical beast. I also pass the `--quiet` option on both, just to land on a clean terminal on entry :) – Tasos Papastylianou Jul 26 '16 at 21:10
  • @TasosPapastylianou Your GUI looks way more inviting. I am probably just going to use `--quiet` to clean it up a tad bit more; thanks! – akad3b Jul 26 '16 at 21:43
  • I think it's just because you have the 'large' icons / fonts. If you go in the "General" settings and change icon size / presence, and tone down the fonts in the fonts section, it will be come a lot more usable. – Tasos Papastylianou Jul 26 '16 at 21:49
  • I have the 'small' toolbar icon option selected, and it looks hideous like it does for @akad3b. There don't seem to be any options in Preferences-General to fix this. – Bernoulli Lizard Apr 09 '22 at 21:20

6 Answers6

62

I also install through brew I found that just run:

octave-cli

you will see the octave in terminal:

GNU Octave, version 4.2.0-rc2
Copyright (C) 2016 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
    ...
octave:1>
meeme
  • 778
  • 7
  • 8
  • 1
    `brew install octave-cli` gives me an error saying that the formula wasn't found. – azizj Jul 19 '17 at 11:09
  • 3
    @AzizJaved The command is `brew install octave` not ~~octave-cli~~ – Neeraj Jain Sep 11 '18 at 18:03
  • I find that on windows I can launch octave-cli from a cmd or powershell, but if I try in a git bash window, it just hangs (git 2.17.1.windows.2) and I have to kill it from the task manager (ctrl-C not strong enough) – RubeRad May 07 '19 at 21:02
4

you can get the infomation from the wiki of octave http://wiki.octave.org/Octave_for_Microsoft_Windows:

Octave-3.8.2

The site that provide previous version of octave for windows of ver. 3.8.2 (unofficial build using mxe-octave) is closed. A mirrored binary can be downloaded at File list of Octave for Windows.

If you got any problems while running Windows 8 or libstdc++-6.dll errors, try this octave-gui.bat file and place it into your Octave folder (e.g. C:/octave/octave-3.8.2).

@echo off
set PATH=%CD%\bin\
start octave --force-gui -i --line-editing
exit

Simplely, you can just add the the C:\Octave\Octave-3.8.2\bin folder path to your Environment Variables , like this:

enter image description here

Ferris
  • 5,325
  • 1
  • 14
  • 23
4

According to here :

octave -W

will force octave to open in CLI. It works for me.

4

On MacOS, if installed Octave by dmg file, you can add alias to your ~/.bashrc file.

alias octave-cli='/Applications/Octave-4.4.1.app/Contents/Resources/usr/bin/octave-cli'

Then start octave-cli in command line by 'octave-cli'.

PokerFace
  • 811
  • 2
  • 9
  • 15
  • Tried this there's no octave-cli file at that location unfortunately. – user1821961 Dec 24 '19 at 23:14
  • 1
    @user1821961 Make sure that in the string, you change the version to what you have installed. Here the version is "4.4.1". Also, in that 'bin' folder find the binary file to run octave, e.g. for me, it is 'octave-octave-app@5.2.0' rather than 'octave-cli'. And finally, in MacOS you may want to put it in ~/.bash_profile rather than ~/.bashrc – MorTezaDM Nov 17 '20 at 03:29
2

for mac os

alias octave-cli='/Applications/Octave-4.4.1.app/Contents/Resources/usr/bin/octave-octave-app --no-gui'

https://octave.org/doc/v4.2.2/Command-Line-Options.html#Command-Line-Options

beta Joe
  • 191
  • 2
  • 4
2

On Windows, with Octave version 6.2.0

D:\Programs\GNU_Octave\Octave-6.2.0\mingw64\bin>octave-cli.exe

Side note: I installed into a custom path without spaces, NOT the default path which would have been in C:\Program Files\GNU Octave. At least some features failed when I had spaces in the path. I'm not sure if the octave-cli would have worked.

Full console output:

D:\Programs\GNU_Octave\Octave-6.2.0\mingw64\bin>octave-cli.exe
GNU Octave, version 6.2.0
Copyright (C) 2021 The Octave Project Developers.
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-w64-mingw32".

Additional information about Octave is available at https://www.octave.org.

Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html

Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1>
ubienewbie
  • 1,771
  • 17
  • 31
  • Using `double quote` will do for path with spaces: ```"C:\Program Files\GNU Octave\Octave-6.2.0\mingw64\bin\octave-cli.exe"```. Sadly though, making an alias in Windows is painfull. See others answer about alias in windows [here](https://stackoverflow.com/a/21040825/11671779). – Muhammad Yasirroni Jan 08 '22 at 07:27