0

I'm sending a bash script as a .command file to a friend. This person is not very tech savvy which is why I'm sending it in the first place, the goal is for the .command file to run through the shell operations for them. However when the attempt to run the script they get the run.command is damaged and can't be opened. You should move it to the Bin error. I believe this is a new version of the old unsigned developer prompt as apple is blocking out random code from their systems. Anyway I can have this run without too much complexity?

Edit: I'm open to using applescript if this will alleviate the issue.

  • Adding the actual script to your question might help as well... – Steve Chambers Aug 7 at 23:56
  • @SteveChambers I think the script is irrelevant, it only contains one command, it runs a julia script with some arguments. – stmfunk Aug 8 at 10:42
  • I'm not convinced that all bash scripts copied between computers will result in a 'damaged' error. Nor that bash scripts need to be code-signed. (They don't.) Try zipping it at your end, then sending. – benwiggy Aug 8 at 13:44
  • @benwiggy no i don't believe they all will, I think the issue arises when trying to run the script by opening it from the finder. I did send it as part of a zip file – stmfunk Aug 8 at 13:55
  • I have any number of scripts that I can move between two Macs, without problem. – benwiggy Aug 8 at 14:57
1

AppleScript

Wrap the shell script in a do shell script AppleScript command:

do shell script "say \"hello world\""

If your script needs administrator rights, append with administrator privileges to the command:

do shell script "say \"goodbye moon\"" with administrator privileges

Using Script Editor.app in /Applications/Utilities, you can save the AppleScript as a .applescript text file that will launch in Script Editor on the host computer.

The end user will need to select the menu item:

  • Script (menu) > Run

Alternatively, you can Export as an Application and code sign the resulting application. This assumes you have a code signing certificate available.

Script Editor's Export dialog on macOS

Automator

An Automator workflow can also include shell scripts and AppleScripts. Automator can also save as an application, with the Export… menu item also prompting to code sign the result for you.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .