Mac 操作系统:/usr/bin/env:错误的解释器:不允许操作 [英] Mac OS: /usr/bin/env: bad interpreter: Operation not permitted

查看:26
本文介绍了Mac 操作系统:/usr/bin/env:错误的解释器:不允许操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 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 操作系统:/usr/bin/env:错误的解释器:不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆