Reputation: 5384
I want to make a script that can be downloaded and run by a non-technical Mac user. I do not want to make them open up the Terminal window and type commands.
I want the entire process to be as easy as possible.
Is there a way to acheive this?
Upvotes: 0
Views: 875
Reputation: 4802
There is a free app called Platypus that will turn your script into a simple Mac app. I use it on my python scripts but it works for many other script types including shell scripts. After running Platypus on your script all a customer has to do is double click the app.
Upvotes: 0
Reputation: 5384
I solved this already, but as I haven't found an article providing explicit help, I thought I would write it up here. In order to deliver a script that is easily run by a non-technical user, you can codesign the executable script and package it up in a DMG which you also codesign. There are a some steps to doing this, so let me unpack it for you into those steps.
```
#!/usr/bin/env bash
# exit the script right away if there are any errors
set -e
# make the distributed script executable
chmod a+x path/to/code/myshell.command # you MUST name this *.command for the signature to persist
# sign the script; replace 'My Entity (blahblah)' with the actual value you saw in your Keychain Access app.
codesign -s "Developer ID Application: My Entity (blahblah)" path/to/code/myshell.command
# verify that the script has been signed
spctl -a -t open --context context:primary-signature -v path/to/code/myshell.command
# create the Disk Image with the contents of the path/to/code directory
hdiutil create -ov -srcfolder path/to/code path/to/disk-image-file.dmg
# sign the disk image
codesign -s "Developer ID Application: My Entity (blahblah)" path/to/disk-image-file.dmg
# verify that the disk image has been signed
spctl -a -t open --context context:primary-signature -v path/to/disk-image-file.dmg
```
Now, when the customer opens up the disk image, they can simply double-click the *.command file and it will launch on their computer. It will ask them if they're sure, but that is better than the default of not allowing it.
Upvotes: 2