You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Unable to execute shebang scripts after chmod +x

I've been unable to run Python, Ruby, & Node scripts marked with a shebang.


Before preforming a a factory reset with the help from an Apple Genius, I was able to use chmod +x to make a script executable. Since the reset, the same scripts returns "permission denied". If I try to run the script with sudo, "unable to execute" is returned.


Any ideas of how to fix this? Based on my web searches, it may have to do with a noexec flag listed after using the mount command.


User uploaded file

MacBook Pro (15-inch, 2017), macOS High Sierra (10.13.6)

Posted on Aug 4, 2018 3:38 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 4, 2018 8:22 PM

That #!/usr/local/bin<space>python3 is an incorrect invocation. As there is no python3 installed by Apple, you can use either of the following:


#!/usr/local/env python3

or

#!/usr/local/bin/python3


The latter would simply be a link into the Python3 framework that is likely installed in Library/Frameworks.


I believe that noexec option in the mounted filesystem will halt any attempt to execute code on it.

Similar questions

4 replies
Question marked as Top-ranking reply

Aug 4, 2018 8:22 PM in response to mick-io

That #!/usr/local/bin<space>python3 is an incorrect invocation. As there is no python3 installed by Apple, you can use either of the following:


#!/usr/local/env python3

or

#!/usr/local/bin/python3


The latter would simply be a link into the Python3 framework that is likely installed in Library/Frameworks.


I believe that noexec option in the mounted filesystem will halt any attempt to execute code on it.

Unable to execute shebang scripts after chmod +x

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