Make a shell script runnable from the finder on Mac OS X

Once again, I find myself struggling to make something work as it should on Mac OS X. I simply wanted to make a shell script executable.

On a standard Linux distro you’d simply create a .sh file, make it executable and you’d be able to run it by double clicking on it from your graphical file explorer. Doing that on Mac OS X does weird things. A simple double click will bring up Xcode. You can however run the script by right clicking on it and “open” it with a terminal application.

Running Sh

The trick, while not obvious, is quite simple. Just change the .sh file extension to .command. Don’t forget to make your file executable and you’re good to go. Double clicking your script will bring up the default terminal emulator and run the content of your file.

Running Command



Enter your desired user name/password and after your comment has been reviewed by an admin it will be posted and your account will be enabled. If you are already registered please login before posting.