4

I wrote a shell script that I'm distributing to my friends. On my computer, it works great, because I set the default application for shell scripts to be Terminal. However, when my friends open it, the script opens in TextEdit. Is there a way to add an argument to the shell script before it launches so it opens in Terminal instead of a text editor?

Thanks

PS, I did chmod a+x to the file. I also made sure to add #!/bin/sh to the script. I've also been testing with using the extensions .command, .cmd, and .tool. That would solve my problem except then Gatekeeper won't let the script run because I'm not a registered Apple Developer.

Active Citizen
  • 119
  • 3
  • 12

1 Answers1

4

If there were a way to make double-clicking a file run it, then that would be the sort of security hole that Gatekeeper is designed to prevent. So, Apple has plugged any such holes they can think of.

Send the file to your friends as a .command file and tell them to right-click or Control-click on it and choose Open. This will change the Gatekeeper dialog to a warning, but with an "Open" button to let them go ahead and open it anyway. The system will prompt them for an administrator password to record the grant of permission in a permanent way. They'll be able to open with a simple double-click from then on.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154