24

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?

1 Answer 1

47

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.

7
  • 2
    So the error message is wrong and I can't fix the permissions by going to the Get Info window like it says? I don't have a problem with using the Terminal to fix it, I'm just surprised that the message might tell me to do something wrong. Dec 15, 2013 at 21:21
  • @Thunderforge Indeed, it's wrong, as far as I know :) I'm pretty sure Finder can't do it — you have to do it using Terminal or other script.
    – grg
    Dec 15, 2013 at 21:23
  • +1 for explaining what u+x means. I had always wondered.
    – Luc
    Nov 9, 2015 at 3:02
  • 2
    @Thunderforge Yes, it's so shocking that Apple has a useless error message... Be thankful they have one at all, and it's essentially correct even. Their m/o is to normally just have something fail with no explanation why, or that you should expect anything to happen. That's why laymen say Apple devices never have errors!
    – BuvinJ
    Nov 17, 2016 at 19:19
  • 1
    @BuvinJ What's more shocking is that ~7 years after OP posted, this still is happening. Haha Mar 20, 2020 at 2:20

You must log in to answer this question.

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