% ./script.sh
zsh: permission denied: ./script.sh
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 script.sh
Adding execute permission to the file:
Use the chmod command to add execute (x) permissions to the script.
chmod +x script.sh
Now if I try to run the script again it works!
% ./script.sh
Hello, World!
![zsh: permission denied zsh: permission denied](https://code2care.org/zsh/fix-zsh-permission-denied-error/images/zsh: permission denied.png)
zsh: permission denied
Have Questions? Post them here!
More Posts related to zsh,
- Resolve - zsh: command not found: code
- zsh: command not found [fix] macOS
- How to fix: zsh: command not found: jupyter
- How to make ZSH as the default shell on Ubuntu
- How to Add New Entry to ZSH PATH
- Add Syntax Highlighting in Zsh Shell
- Fix: zsh: command not found: npm after installation (Node.js)
- Fix: zsh: command not found: mysql (Mac XAMPP)
- Ubuntu zsh: command not found: nano
- Fix: ZSH: cd: too many arguments (macOS)
- Fix - cd: no such file or directory: .zshrc
- How to reload zsh shell profile file?
- Fix zsh: permission denied: script.sh
- [fix] zsh: illegal hardware instruction python TensorFlow M1/M2 Mac
- macOS Ventura 13: The default interactive shell is now zsh
- How to Add Autocomplete in Mac Terminal
- Fix - zsh: command not found: pip
- ZSH: exec format error eclipse M1/M2 Mac
- Setting up Zsh Syntax Highlighting
- How to reload Zsh .zshrc Profile
- zsh: command not found: brew [fix]
- How to clear ZSH history of commands executed on Mac Terminal
- Fix - zsh: command not found: conda [macOS]
- Fix: cd: string not in pwd
More Posts:
- Change Google Chrome Browsers default download location - Chrome
- [Nopepad++] How to add text at end of each line - NotepadPlusPlus
- Android Studio : Connection Error : Failed to download patch file - Android-Studio
- How to Delete a Sheet in Excel on Mac - Microsoft
- Remove Apps from Dock when Quit [Mac Ventura] - MacOS
- Create a Zip file using Java Code programmatically - Java
- Fetch as Google Crawl Error or Redirected Status - Google
- AWS S3 CLI BucketAlreadyExists when calling CreateBucket Error make_bucket failed - AWS