Mac OS X - run shell script from the desktop GUI

dreftymac picture dreftymac · Jun 10, 2010 · Viewed 42.6k times · Source

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 ?

Answer

Paul R picture Paul R · Jun 10, 2010

Yes - just put a .command suffix on the script.

Note: make sure the script is executable, e.g.

$ chmod +x myscript.command