简体   繁体   中英

How can I start octave from the command line and not the GUI?

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.)

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>

According to here :

octave -W

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

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 (eg 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:

在此处输入图片说明

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'.

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM