I have a bash file that does some file manipulation. I don't want to have to open the terminal every time I run it. Is there a way to make the program run when I double click it? (Like a windows .exe file)
Thanks
I have a bash file that does some file manipulation. I don't want to have to open the terminal every time I run it. Is there a way to make the program run when I double click it? (Like a windows .exe file)
Thanks
What you need is Platypus
.
Platypus is a developer tool for the Mac OS X operating system. It can be used to create native, flawlessly integrated Mac OS X applications from interpreted scripts such as shell scripts or Perl and Python programs. This is done by wrapping the script in an application bundle directory structure along with an executable binary that runs the script.
With OS X 10.5+, you can wrap the bash shell script in an AppleScript
application using the AppleScript
editor or an Automator
application using Automator.app
(see the Automator
on-line help).
You could write (and there are apps out there that do this) an OS X app that accepts arbitrary .sh
files and executes them. However, that's generally a bad idea as it could open you up to attacks if you inadvertently download a malicious shell script file that is automatically opened by your web browser. Better to be explicit.
You can add a ".command" extension to the filename -- then double-clicking it will automatically open Terminal and run the script in a new window. Note: this assumes you still want to watch/interact with the script via a Terminal interface; if you want to avoid this as well, wrapping the script with Platypus, AppleScript, or Automator (as Zifei and Ned suggest) would be better options.