How to make a command line executable an application?

Use Automator.

  1. Open Automator and double-click on Application.
  2. In the "Name" search box, type Apple and you should see "Run AppleScript".
  3. Drag "Run AppleScript" into the right-hand window.
  4. Where it says (* Your script goes here *), replace that text with the following code:

    tell application "Terminal"
        activate
        do script with command "JMeter"
    end tell
    
  5. File > Save and enter a name, and choose where to save the application.
  6. Double-click on the newly created application.

Short answer:

do shell script "/your/script/path/shellscript.sh"

Use this snippet in an AppleScript, then save it as an application.


Here are the commands to create a minimum version of the app which runs top command:

APP=Foo
mkdir -vp ${APP}.app/Contents/MacOS ${APP}.app/Contents/Resources # Create the folders.
PATH="$PATH:/usr/libexec" # Make sure PlistBuddy is in the PATH.
printf '#!/usr/bin/osascript\ntell application "Terminal"\n\tactivate\n\tdo script "top"\nend tell\n' > ${APP}.app/Contents/MacOS/${APP}
chmod +x ${APP}.app/Contents/MacOS/${APP} # Sets the executable flag.
PlistBuddy ${APP}.app/Contents/Info.plist -c "add CFBundleDisplayName string ${APP}"
PlistBuddy ${APP}.app/Contents/version.plist -c "add ProjectName string ${APP}"
find ${APP}.app # Verify the files.
open ${APP}.app # Run the app.

Note: The above commands should be executed in shell e.g. in Terminal.

In above code, you can replace top with your shell command.


In case, you're dealing with Windows apps, consider using WineBottler app.