Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,987
4,561
New Zealand
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! :)
 

chscag

macrumors 601
Feb 17, 2008
4,622
1,946
Fort Worth, Texas
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)
 

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,987
4,561
New Zealand
I've actually already done that but forgot to mention it; it enables the "Anywhere" option but still prompts for confirmation.
 

Nermal

Moderator
Original poster
Staff member
Dec 7, 2002
20,987
4,561
New Zealand
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 \;
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.