'Terminal error: zsh: permission denied: ./startup.sh
I am running a command ./startup.sh nginx:start
and I am getting this error message zsh: permission denied: ./startup.sh
why could this be happening?
Solution 1:[1]
Be sure to give it the execution permission.
cd ~/the/script/folder
chmod +x ./startup.sh
This will give exec permission to user, group and other, so beware of possible security issues. To restrict permission to a single access class, you can use:
chmod u+x ./startup.sh
This will grant exec permission only to user
Solution 2:[2]
Alternatively you can use bash:
bash startup.sh
Then you don't need execution permission.
In MacOS Catalina, Apple has replaced bash with zsh as default shell. This can mean, that they intend to remove bash in the future, so this might not be an option later, but with Catalina it still works.
Solution 3:[3]
Starting with macOS Catalina, Your Mac uses zsh as the default login shell and interactive shell. You can make zsh the default in earlier versions of macOS as well.
How to change your default shell Whether your user account is configured to use zsh (recommended), bash, or another shell, you can change the default shell from Users & Groups preferences or the command line.
- From Users & Groups preferences
- Choose Apple menu ? > System Preferences, then click Users & Groups.
- Click the lock , then enter your account name and password.
- Control-click your user name in the list of users on the left, then choose Advanced Options.
- Choose a shell from the ”Login shell” menu, then click OK to save the changes.
Follow link for more details - https://support.apple.com/en-in/HT208050
Solution 4:[4]
add sudo
before command start, will save your time like
sudo anyTemninalCommand
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Gefilte Fish |
Solution 3 | Suraj Pawar |
Solution 4 | Jagveer Singh |