Gatekeeper blocking text files

Discussion in 'macOS Sierra (10.12)' started by Nermal, Mar 24, 2018.

  1. Nermal Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #1
    Hi,

    Can anyone advise how to stop Gatekeeper from getting in the way when opening text files? I'll try to explain this as best I can:

    - I have a zip file, created on a non-Mac machine, containing hundreds of text files (containing C source code)
    - I have unzipped the file using the built-in Archive Utility
    - The text files have no file extensions and are reported by Finder as being "Unix executables" with the "exec" icon
    - If I drag a single file onto TextEdit, Gatekeeper pops up and makes me confirm whether to open the file
    - Re-opening the same file a second time doesn't show the Gatekeeper prompt, so that specific file is flagged as "safe"

    The big problem is when I drag multiple files onto TextEdit at once. Gatekeeper will ask me to confirm a single file, and will completely ignore all the others (i.e. only one file actually opens in TextEdit). If I repeat that step then I get the prompt for the next file, and two files open in TextEdit. Attempt three opens three files, and so on.

    How can I tell the system that I don't need Gatekeeper to verify these text files? I think the crux of the issue is that MacOS thinks they're Unix executables, but I'm not sure how to tell it that they're all just plain text.

    Help! :)
     
  2. chscag macrumors 68030

    chscag

    Joined:
    Feb 17, 2008
    Location:
    Fort Worth, Texas
    #2
    Would it be convenient to turn off Gatekeeper from terminal as long as you're working with those files and afterward turn it back on again?

    sudo spctl --master-disable (off)

    sudo spctl --master-enable (on)
     
  3. Nermal thread starter Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #3
    I've actually already done that but forgot to mention it; it enables the "Anywhere" option but still prompts for confirmation.
     
  4. BrianBaughn macrumors 603

    BrianBaughn

    Joined:
    Feb 13, 2011
    Location:
    Baltimore, Maryland
    #4
    Add the extension to the files...with a files renaming app if necessary.
     
  5. Nermal, Mar 25, 2018
    Last edited: Mar 29, 2018

    Nermal thread starter Moderator

    Nermal

    Staff Member

    Joined:
    Dec 7, 2002
    Location:
    New Zealand
    #5
    Thanks; I can confirm that adding .txt (or .c) to the name causes it to open without confirmation. What a mess though... I'm sure in the "old days" MacOS didn't care about the extensions! This sort of thing "should" be separate metadata, not part of the name, but that digression will probably open a can of worms so I'll shut up now :)

    Edit: In case it helps (but mainly for my own reference :p), this will add the .c extension to all the files in a directory:

    Code:
    find . -type f -exec mv '{}' '{}'.c \;
     

Share This Page