I've always wanted to be able to run a script I've downloaded online directly from the Finder but just double clicking the file does not work.
Follow these steps to run the script files:
Right-click on the .sh file.
Hover over Open With.
You should be in the Applications folder. Open Utilities folder and select Terminal.app.
If you can't select Terminal.app, change the enabled applications from Recommended Applications to All Applications. It is at the bottom of the window.
If you want to open every
.shfile with Terminal.app, tick Always Open With.
Press the Open button in the bottom right corner of the window.
The reason it doesn't work after downloading is the file permissions don't allow it. To enable execute permissions, open Terminal and type
chmod 755 /path/to/script.
Instead of typing the full path, you can drag the script onto the Terminal window from Finder.
Then, to execute, just enter
Again, you can drag and drop the file onto the Terminal window. This syntax should execute the script using the correct shell as defined on the first line of the script.