Fix zsh: permission denied:

% ./               
zsh: permission denied: ./

If you are trying to execute a script on the Terminal using the Zsh shell and you get permission denied then make sure that the script has the execute permissions. You can do that by using the ls command.

% ls -ltrh
total 2832
-rw-r--r--  1 code2care  staff     5B Jul 19 11:50
Adding execute permission to the file:

Use the chmod command to add execute (x) permissions to the script.

chmod +x

Now if I try to run the script again it works!

% ./
Hello, World!
zsh: permission denied
zsh: permission denied

Have Questions? Post them here!

Recent Posts:

Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.