1. Home
  2. Mac OS X
  3. Fix file could not be executed because you do not have appropriate access privileges macos

How to fix “File could not be executed because you do not have appropriate access privileges” on macOS

AppleScripts are the common script type you’ll find on macOS but, there are other scripting formats that also work on the OS. One particular type of format is the .command format which is used to package Terminal commands. If you have a .command file, it is basically a set of commands that are meant to run in the Terminal. The file is going to save you the trouble of having to write the command out every time you need to run it. It’s simple enough but if you have a .command script that you’re trying to run, and you keep getting the “File could not be executed because you do not have appropriate access privileges” your script needs to be authorized to run.

What’s unhelpful about this error is that it points you to the worst place to fix it; the Get Info window. That isn’t going to be of any help. Here’s what you need to do.

Fix “File could not be executed because you do not have appropriate access privileges”

Open Terminal and run the following command. Replace ‘Path-to-file’ with the complete path to the .command file you’re trying to run. If prompted to, enter the user password.

Syntax

chmod u+x "path-to-file"

Example

chmod u+x /Users/Fatimawahab/Desktop/script.command

Once the command has been run, the file in question will have the permission it needs to run. Double-click it and it should run without any error messages.

This permission is set on a per-file basis. This means that while you can use the command to run the file that you entered the path to, you won’t be able to summarily run all .command files. For each .command file you want to run, you’re going to have to grant it permission first. Additionally, this is set on a per-user basis so the file can only be run by the user that it was granted permission by. That said, you can modify the command so that permission is granted to the script to run for all users. Simply replace the ‘u’ in the command with ‘a’.

Syntax

chmod a+x "path-to-file"

You will, of course, need to enter the admin password this time around because the change is being made for all users which isn’t something an ordinary user can do.

If you ever want to revoke permission for the file, run the following command.

Syntax

chmod -x "path to file"

Example 

chmod -x /Users/Fatimawahab/Desktop/script.command

The ‘x’ in the command basically makes the file ‘executable’. The minus sign that precedes it in the last command revokes that permission.

4 Comments