Question

I have a command that I regularly need to run in the Terminal (for application code signing). Normally I launch the Terminal, press the up arrow until I reach the command I want, and then hit enter.

I've decided that a more sustainable solution might be to create a file I can just double-click to run the Terminal command. In my searches, I discovered that I could create a text file with the .command extension which contains the command that I want to run.

However, when I double-click on this file, the Terminal opens and I get the following error:

The file “Sign Code.command” could not be executed because you do not have appropriate access privileges.

To view or change access privileges, select the file in the Finder and choose File > Get Info.

The problem is that when I go to the Get Info wind as directed and look at my Permissions, it says that my user has read-write access (the only other option is read). So in other words, I have the highest permissions, but still can't open this file.

What can I do to solve this?

Was it helpful?

Solution

You need to set 'execute' on the file for it to allow you to run it:

chmod u+x /path/to/file.command

u is the owner of the file, +x adds 'execute', so u+x gives the owner of the file the ability to execute it

…then you can run it in the future by double-clicking it.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top