Mac OS: /usr/bin/env: bad interpreter: Operation not permitted

后端 未结 4 779
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 17:40

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: Op         


        
相关标签:
4条回答
  • 2020-12-04 18:12
    -bash: /usr/local/bin/bbcolors: /usr/bin/env: bad interpreter: Operation not permitted
    

    Does /usr/bin/env exist? Can you run it? Run by itself it should dump your environment variables to stdout.

    You can safely replace:

    #!/usr/bin/env perl
    

    With the full path to your perl binary of choice, e.g:

    #!/usr/bin/perl
    
    0 讨论(0)
  • 2020-12-04 18:17

    pilcrow's answer is correct, however I draw your attention to the fact that if you are working with a disk image, the problem can be very confusing, as the com.apple.quarantine attribute seems to be inherited from the disk image file to the files inside (thanks to febeling at Apple dev forums for noticing that!).

    To solve the problem, you have to remove the quarantine attribute from the disk image:

    xattr -d com.apple.quarantine /path/to/disk/image
    

    and then eject and remount the disk image. Then your files will be clean again.

    0 讨论(0)
  • 2020-12-04 18:21

    I had resolved this issue.Open the command file with TextEdit then save it.

    More Info:Resolved Operation not permitted

    0 讨论(0)
  • 2020-12-04 18:24

    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.

    0 讨论(0)
提交回复
热议问题