Previous 1 2 3 4 5 Next 71 Replies Latest reply: Apr 10, 2013 4:05 AM by mikeamy Go to original post
  • Frank Caggiano Level 7 Level 7

    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 http://reviews.cnet.com/8301-13727_7-57374676-263/workarounds-for-quarantine-bug -in-os-x-lion/

  • Linc Davis Level 10 Level 10
    expertise.desktops
    Desktops

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

  • BobHarris Level 6 Level 6

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

     

    TextWrangler (free download)

    <http://www.macupdate.com/info.php/id/11009/textwrangler>

     

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

  • galfenol Level 1 Level 1

    Running the find to remove the exteneded attributes did not remove the quarantines from the scripts.

  • Linc Davis Level 10 Level 10
    expertise.desktops
    Desktops

    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.

  • galfenol Level 1 Level 1

    Thank you everyone who contributed to debugging this issue. I am now getting used to TextWrangler, which has some nice features, like running scripts from within the editor.  All the best.

  • etresoft Level 7 Level 7

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

     

    Pandora:bin jdaniel$ ls -@Oel hw.sh

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

              com.apple.TextEncoding          15

              com.apple.quarantine          23

    Pandora:bin jdaniel$ ./hw.sh

    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.

  • galfenol Level 1 Level 1

    On both machines running 10.7.3 where I have this (TextEdit) problem, my accounts are in the Admin group.

  • Frank Caggiano Level 7 Level 7

    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.

     

    regards.

  • etresoft Level 7 Level 7

    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

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

     

     

    admac:Desktop frank$ cat foo.sh

    #!/bin/bash

    echo script

    admac:Desktop frank$ ls -l@ foo.sh

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

              com.apple.TextEncoding          15

              com.apple.quarantine          23

    admac:Desktop frank$ ./foo.sh

    -bash: ./foo.sh: /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?

  • etresoft Level 7 Level 7

    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

    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 Level 1 Level 1

    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 TextEdit.app 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" badscript.pl > goodscript.pl

     

    Run a CHMOD again on goodscript.pl and viola, it now works!  This process is repeatable.  Thus I believe that TextEdit.app 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

    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