Skip navigation

bad interpreter: Operation not permitted on Lion 10.7.3

23778 Views 71 Replies Latest reply: Apr 10, 2013 4:05 AM by mikeamy RSS
  • Frank Caggiano Level 7 Level 7 (22,760 points)

    See this TextEdit quarantines files its been reported since 10.7.3 came out.


    Google textedit quarantine you'll get a bunch of hits.



    However, there appears to be a bug in the latest version of OS X Lion in which the quarantine flag is attached to existing files on the system, preventing some code such as user scripts from being executed. If you create shell scripts, for instance, then opening them in TextEdit and making changes to them will result in them no longer being executable and will result in an "Operation not permitted" error in the Terminal.



    from -in-os-x-lion/

  • Linc Davis Level 10 Level 10 (107,665 points)

    The solution is simple. Don't use TextEdit to edit scripts.

  • BobHarris Level 6 Level 6 (12,505 points)

    I would suggest trying TextWrangler to edit his scripts, assuming he wants a GUI editor.


    TextWrangler (free download)



    PS.  Linc was definitely on the right track to suspect the quarantine attribute as the root cause of the problem.

  • Linc Davis Level 10 Level 10 (107,665 points)

    Yes it did. I've tested that command, and it works. When you open the scripts in TextEdit, as we now know, the attribute is restored.

  • etresoft Level 7 Level 7 (23,895 points)

    I created a script in TextEdit. This is the result:


    Pandora:bin jdaniel$ ls -@Oel

    -rwxr--r--@ 1 jdaniel  admin  - 30 14 Feb 22:39



    Pandora:bin jdaniel$ ./

    Hello, World


    Maybe the problem is your group. I created a standard user account and could finally reproduce your problem by using TextEdit, but not in my normal admin account.

  • Frank Caggiano Level 7 Level 7 (22,760 points)

    Same here, when I reproduced this yesterday it was in an admin account also. Definitely a bug in TextEdit.


    Not a total loss I think you'll like TextWangler. It has some nice features.



  • etresoft Level 7 Level 7 (23,895 points)

    It is not a bug in TextEdit. I can create scripts using TextEdit and execute them. The files still have the quarantine flag. Whatever it is, is something else.

  • Frank Caggiano Level 7 Level 7 (22,760 points)

    Well I have two 10.7.3 systems, an iMac and MacBook ad they both do it:



    admac:Desktop frank$ cat


    echo script

    admac:Desktop frank$ ls -l@

    -rwxr--r--@ 1 frank  admin  24 Feb 15 09:38*



    admac:Desktop frank$ ./

    -bash: ./ /bin/bash: bad interpreter: Operation not permitted




    Just to be certain you are on 10.7.3? I ask because your profile shows 10.7.2.


    One other thing you don't have quarantining disabled on your system?

    iMac 3.06ghz 8gb 1 TB, Mac OS X (10.7.3), Aperture 3.2.2
  • etresoft Level 7 Level 7 (23,895 points)

    I am on 10.7.3. I also get the bad interpreter error when I create a new standard account. I do not get the error in my normal, admin account. Obviously something in my environment is disabling the check. I haven't disabled quarantine as far as I know. I try to keep the system as close to default as possible. However, I do have a few customizations.

  • etresoft Level 7 Level 7 (23,895 points)

    It might be a good idea to learn your way around vi. That is what I normally use for command-line editing. I only use TextWrangler if I am really heavy into something and/or need its particular talents.

  • jim505 Calculating status...

    I too have been having the same issue, only I think there is something else going on here.  I tried editing an ubber-simple Perl script using both TextEdit and VI (actually VIM on the Mac).  Both exhibit the same issues with the bad interpreter. I have seen the same behavior when bringing such scripts saved on Windows platforms into a UNIX environment because the Windows editors add the newline character at the end of every line. (Manifests as ^M when viewed in VI; but that does nothing in VIM!  So, I tried creating an identical looking script in VIM and saving is right from the Terminal window. After CHMOD to set the execute bits, it ran fine. If I opened the same file in and added but a single space into the file and saved, the same script was broken again! So next I tried running the now corrupted script through a SED filter, thus:


    sed -e "s/^M//g" >


    Run a CHMOD again on and viola, it now works!  This process is repeatable.  Thus I believe that is placing HIDDEN ^M's into the file, and seems to lack an option or Preferences setting to reveal them to us.  (Pure VI on UNIX will do this for you, whereas  "cat" or "more" command will reveal NOTHING!


    I would like to know if someone else here can corrobreate this - or even refute it. I will be glad to hear that it is something other than what I've proposed here.  Good dialog though, and a lot of interesting ideas.

  • BobHarris Level 6 Level 6 (12,505 points)

    TextWrangler and Vim will preserve the line ending style of the file it is editing.


    TextWrangler -> Edit -> Document Options... allows changing the line ending style.  You want to select Unix, as the "Mac (CR)" option is for the Mac Classic OS, not Mac OS X.


    In Vim, you can change from DOS to Unix style line ending using


    :set ff=unix


More Like This

  • Retrieving data ...

Bookmarked By (1)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.