Apple - How to create an executable file for an AppleScript?

  1. Write your AppleScript in Script Editor.

  2. Choose FileSave and select Application as File Format.

This gives you an .app which will run your AppleScript when opened.

  1. Write your shell script in a text file, including the shebang.

    If you're just using AppleScript, you can use osascript as the shebang:

    tell app "Finder" to display dialog "message"
  2. Set the executable bit on the file.

    chmod +x /path/to/file

This gives you a file which will run your shell script when opened.

You can save it as a script by putting this in a plaintext file and save it as something like

osascript -e 'tell app "Finder" to display dialog "message"'

Then making the file executable in the terminal by running chmod +x /path/to/
Execute in terminal by running /path/to/