本文介绍了Mac OS中:在/ usr /斌/ ENV:不好间preTER:不允许操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行在Mac OS 10.7(狮子)这个剧本,我得到的错误:

  $ bbcolors
-bash:在/ usr / local / bin目录/ bbcolors:在/ usr / bin中/ ENV:不好间preTER:不允许操作

我已经成功地在我的其他Mac运行此脚本。这只是的来自Daring Fireball的下载和修改。

我发现,提供一个非常类似的问题,但接受的答案是,文件系统对安装了noexe选项。我是pretty肯定不是这样的我,因为我刚刚拿到了它在/ usr / local / bin目录/和其他的东西在里面工作正常(它也不会从其他地方或其他用户运行包括root)。

  $其中bbcolors
在/ usr / local / bin目录/ bbcolors
$ ls -l命令在/ usr / local / bin目录/ bbcolors
-rwxr-XR-X @ 1尼克人员9751年03月30 19:09在/ usr / local / bin目录/ bbcolors

这是一个Perl脚本不是编译的二进制,而不是应该没关系。下面是它的价值了一些额外的信息:

  $猫的/ usr / local / bin目录/ bbcolors |头-n 1
#!的/ usr / bin中/ perl的包膜
$其perl的
在/ usr /斌/ perl的
$ ENV | grep的PATH
PATH =的/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录:在/ usr / local / bin目录:在/ usr / X11 / bin中


解决方案

你碰巧打开/保存文件的文本编辑?

这可以引入文件系统元数据(检疫属性)。

尝试:

  XATTR -l在/ usr / local / bin目录/ bbcolors

  XATTR -d com.apple.quarantine在/ usr / local / bin目录/ bbcolors

如果你看到隔离属性。

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

I've successfully run this script on other Macs of mine. It's just this script downloaded and unmodified from Daring Fireball.

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

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
解决方案

Did you happen to open/save the file in TextEdit?

That can introduce filesystem metadata (quarantine attribute) leading to the symptom you describe.

Try:

xattr -l /usr/local/bin/bbcolors

and

xattr -d com.apple.quarantine /usr/local/bin/bbcolors

if you see the quarantine attribute.

这篇关于Mac OS中:在/ usr /斌/ ENV:不好间preTER:不允许操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 02:49