You can create a shell script or a Python or Ruby script and run it on the Mac by using "Terminal" ... if you have Finder open, and you click on the icon for the file containing the source code of a saved shell script, is there a way to have that script run, instead of opening in my text editor ?
To run from command prompt, use either Windows Key + R and type 'cmd' or click start and type 'cmd' into search box. Then you can drag your script to the command prompt window and press Enter to run it. If you wanted to run it by double click, you'd need something to stop it from finishing until you'd read the message.
Mac's default shell is either zsh (Z shell) or bash (Bourne-again Shell). This default shell is determined by the version of macOS you're running. For macOS Mojave and earlier, the default shell is bash. For macOS Catalina and later, the default shell is zsh.
Yes - just put a .command
suffix on the script.
Note: make sure the script is executable, e.g.
$ chmod +x myscript.command
Just another quick alternative is the tool platypus (http://sveinbjorn.org/platypus/). Free and good, but you can donate, if you want.
Platypus is a developer tool for the Mac OS X operating system. It creates native Mac OS X applications from interpreted scripts such as shell scripts or Perl, Ruby and Python programs. This is done by wrapping the script in an application bundle along with a native executable binary that runs the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With