Mac OS:/usr/bin/env:错误的解释器:不允许操作 [英] Mac OS: /usr/bin/env: bad interpreter: Operation not permitted
问题描述
我正在尝试在 Mac OS 10.7 (Lion) 上运行此脚本,但出现错误:
I'm trying to run this script on Mac OS 10.7 (Lion) and I'm getting the error:
$ bbcolors
-bash: /usr/local/bin/bbcolors: /usr/bin/env: bad interpreter: Operation not permitted
我已在我的其他 Mac 上成功运行此脚本.它只是这个脚本从 Daring Fireball 下载并未经修改的.
I've successfully run this script on other Macs of mine. It's just this script downloaded and unmodified from Daring Fireball.
我发现 这个人有一个非常相似的问题,但公认的答案是文件系统在挂载时有一个noexe"选项.我很确定这对我来说不是这种情况,因为我刚刚将它放在/usr/local/bin/中,并且那里的其他东西工作正常(它也不能从其他地方或其他用户(包括 root)运行).
I found this person with a very similar problem but the accepted answer was that the filesystem had a 'noexe' option on mount. I'm pretty sure that's not the case for me because I've just got it in /usr/local/bin/ and other stuff in there works fine (it also doesn't run from other places or as other users including root).
$ which bbcolors
/usr/local/bin/bbcolors
$ ls -l /usr/local/bin/bbcolors
-rwxr-xr-x@ 1 nick staff 9751 Mar 30 19:09 /usr/local/bin/bbcolors
这是一个 Perl 脚本而不是编译后的二进制文件,这无关紧要.以下是有关其价值的一些额外信息:
It's a Perl script not a compiled binary, not that that should matter. Here's some extra info for what it's worth:
$ cat /usr/local/bin/bbcolors |head -n 1
#!/usr/bin/env perl
$ which perl
/usr/bin/perl
$ env | grep PATH
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
推荐答案
你是不是碰巧在 TextEdit 中打开/保存了文件?
Did you happen to open/save the file in TextEdit?
这可以引入文件系统元数据(隔离属性)导致您描述的症状.
That can introduce filesystem metadata (quarantine attribute) leading to the symptom you describe.
试试:
xattr -l /usr/local/bin/bbcolors
和
xattr -d com.apple.quarantine /usr/local/bin/bbcolors
如果您看到隔离属性.
这篇关于Mac OS:/usr/bin/env:错误的解释器:不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!