The problem of insufficient permissions of shell script in macos system Permission denied

Today I briefly summarized some of the problems encountered when running the script when installing IntelliJ IDEA.

When I first tried to run the script, I kept getting an error: Permission denied.

As shown below:

So I added permissions to the sh script file

chmod +x shell.sh

 I still get an error when running the script, I tried again

chmod 777 shell.sh

The error was still reported, and it was found that it still could not be run, so I checked and found that the permissions of the script had been modified and were the highest permissions (-rwxrwxrwx)

ls -l shell.sh

The result is as follows:

 At this point I suspected it was a problem with .zshrc, so I tried

cd ~
vim .zshrc

After entering i -> :wq save and exit. If :wq cannot exit, use :wq! to force exit.

If it shows 'readonly' option is set (add ! to override), just use: wq! Then press the ENTER key. If you need to select y/n, select y, and then you can execute it.

The final execution was successful!

Reference links:

permission denied: /Users/*******/.zshrc - Jianshu

Readonly option is set (add ! to override) error solution_Chu Xia 0811's Blog-CSDN Blog

Guess you like

Origin blog.csdn.net/Marukooo/article/details/130110984