zsh: operation not permitted when running Perl script

I have an old Perl script that I've been running for many years. I hadn't used it in a while, so I don't know what broke it. I'm running Big Sur now.


Today when I tried to run the script from a Terminal window as "./script.pl" I got the "operation not permitted" error. I ran it as "perl script.pl" and it worked. I have a couple of Perl scripts, and none of them work. I tried giving full disk access to Terminal, but that didn't help. And yes, the "execute" bit is set, and I haven't touched the script since I last used it successfully. I'm making SIP unhappy somehow I reckon.


I tried contacting Apple Support and got, "Third party software ain't our problem." Pointing out that the error is coming from "zsh" didn't help.


My current version of Perl is /usr/bin/perl v5.28.2


I don't want to disable SIP, but any other suggestions would be appreciated.

Parallels, macOS 10.14

Posted on Nov 24, 2020 11:32 AM

Reply

Similar questions

9 replies

Nov 24, 2020 11:54 AM in response to Rodney45

What is the first line in your Perl script.pl? Are you attempting to use Perl modules that are not installed in Big Sur? Are you attempting to run an external application that does not exist from the Perl script, especially if it requires privileges, or is missing input arguments?


Have you given Terminal full disk access?


System Preferences : Security & Privacy : Privacy : Full Disk Access : [+] Terminal


I have Perl scripts here that run just fine on Big Sur.

Nov 24, 2020 12:23 PM in response to Rodney45

Showing us a "toy" Perl script is not the same as the real script that may not be interacting well with the current (Zsh) shell. Without your problematic Perl script posted into the <> code tool in the bottom toolbar, so we can test it here, and see what breaks, we are simply grasping at straws.


A Perl script that may have interacted well with Bash 3.2.57 for years, may not behave as well with a Zsh shell. The error you are receiving is from Zsh, not Perl.

Nov 24, 2020 12:26 PM in response to Rodney45

It is now working...


After successfully running the "Hello world" script, I put "Hello world" and an exit statement as the first two lines in my failing script. It worked.


I removed the "Hello world" and exit statement, and now the script runs normally. I'm at a loss as to why it didn't work previously. I hadn't edited the script since my upgrade to Big Sur. I don't know why an edit would fix it, but I guess I shouldn't complain.


Many thanks for the suggestions.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

zsh: operation not permitted when running Perl script

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