Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

When I give permissions for a file to execute on MacOS, it still doesn't run (MacOS Montery terminal, if that helps)

I am trying to run a script on my mac through the terminal, but even if I give the folder rights to run (chmod +x), it says it doesn't have permissions to do so.


I was simply trying to let the folder run and it keeps giving me the "permission denied" error.

MacBook Air 13″, macOS 12.2

Posted on Apr 4, 2022 11:13 AM

Reply
Question marked as Best reply

Posted on Apr 4, 2022 12:12 PM

Folders do not run…


If you want to run an actual script, then you need to provide the full path to that script, not by attempting to run some unseen script above by attempting to mark the folder executable and attempting to run the folder.


Let's say there is a script in that folder:


# make it executable
chmod +x ~/Desktop/MacIntel/foo.zsh
# now run it
~/Desktop/MacIntel/foo.zsh


Similar questions

5 replies
Question marked as Best reply

Apr 4, 2022 12:12 PM in response to Marko-T

Folders do not run…


If you want to run an actual script, then you need to provide the full path to that script, not by attempting to run some unseen script above by attempting to mark the folder executable and attempting to run the folder.


Let's say there is a script in that folder:


# make it executable
chmod +x ~/Desktop/MacIntel/foo.zsh
# now run it
~/Desktop/MacIntel/foo.zsh


Apr 5, 2022 12:10 PM in response to VikingOSX

More precisely, "execute" permission on a directory allows you to use it in a filename path or alternatively change directory into it.


In the example above, the directory "MacIntel" would need "execute" permission in addition to the file having "execute" permission in order to run it as the example instructs.


% ls -ald MacIntel
drwxr-xr-x  3 user  staff  96 Apr  5 15:00 MacIntel
% ~/Desktop/MacIntel/foo.zsh
Hi there

But, remove the execute permission on MacIntel, and it won't run, and you can't cd into the directory:

% chmod -x MacIntel 
% ls -ald MacIntel
drw-r--r--  3 user  staff  96 Apr  5 15:04 MacIntel
% ~/Desktop/MacIntel/foo.zsh
zsh: permission denied: /Users/user/Desktop/MacIntel/foo.zsh
% cd MacIntel
cd: permission denied: MacIntel


When I give permissions for a file to execute on MacOS, it still doesn't run (MacOS Montery terminal, if that helps)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.