MacOS – How to run a bash script from the desktop

bashdesktopmacos

I have a .sh file with a #!/bin/bash header. I'm able to run it from the terminal, using chmod and ./ but is there a way to perform these two operations from the desktop (i.e. by clicking on it) ?

Btw, I'm familiar with linux, but not with OS X.

Best Answer

You can add a .command extension to your text script.

Then use chmod 744 to make it executable.

When opened or double-clicked in the Finder it will then run from the Terminal.