Octave for macOS: Difference between revisions

428 bytes added ,  13 August 2021
(→‎Homebrew: Strip outdated footnote.)
Line 93: Line 93:
== Create a launcher app with AppleScript ==
== Create a launcher app with AppleScript ==


Open the "AppleScript Editor" application and write the following text in the editor window:
For example Homebrew installs Octave to {{Path|/usr/local/bin/octave}} by default.  From the [https://support.apple.com/guide/terminal/open-or-quit-terminal-apd5265185d-f365-44cb-8b09-71a064a42125/mac Terminal] application you can enter the command <code>which octave</code> to find out the exact location.
 
If you know the installation location, open the [https://support.apple.com/guide/script-editor Script Editor] application and write the following text in the editor window:
 
do shell script "/usr/local/bin/octave --gui"
 
if you wish to start the Octave GUI by default.  If you want to start the Octave command-line interface (CLI), enter instead:


  tell application "Terminal"
  tell application "Terminal"
   do script "/path/to/octave; exit"
   do script "/usr/local/bin/octave; exit"
  end tell
  end tell


(e.g. Homebrew installs Octave to {{Path|/usr/local/bin/octave}} by default) or if Octave is in your default path:
or if Octave is in your default path:


  tell application "Terminal"
  tell application "Terminal"
Line 105: Line 111:
  end tell
  end tell


or if you wish to start the GUI by default, without a terminal:
Finally:
 
* With a script open in the Script Editor app  on your Mac, choose "File > Export".
do shell script "/path/to/octave --gui"
 
Then:
* Select "Save as ..." from the "File" menu
* In the menu that appears, select "Application" from the "File format" menu, then navigate to the "Applications" folder and save your script there as "Octave.app"
* In the menu that appears, select "Application" from the "File format" menu, then navigate to the "Applications" folder and save your script there as "Octave.app"