Run shell script by double clicking in non-login prompt in terminal

The Automator application can be used to create an application that will run a shell script. The steps are given below.

  1. Open the Automator application.
  2. Choose New Document.
  3. Highlight the icon labeled Application, then select Choose.

  4. Under Library, select Utilities, then drag Run Shell Script to the window labeled Drag actions or files here to build your workflow.

  5. Change Pass input: to as arguments, as shown below.

  6. Replace the script with your own text. A simple example is given below.

  7. From the menu bar, select File->Save..., as shown below. When done select Save.

  8. Quit the Automator application.

  9. (Optional) Find the new application in the Finder. Right click on the new application and select Get Info. Drag and drop a new icon set (.icns) file over the existing icon for the application, as shown below.

    The result is shown below.

    Note: A .icns is not the same as a .jpg or .png file. You have to convert .jpg or .png to a .icns file before being used as a icon.

  10. Test the new application. In this case, double clicking on the icon for the new application in the Finder produces the popup shown below.