I'm a big fan of AppleScript and am currently utilising it for a range of different tasks on my computer. However, one thing I have noticed is that after I have created an Application in AppleScript, many of the content files including the main.scpt and the applet.icns files begin appearing in my "Recents" folder in Finder. This can be rather annoying as it quickly clogs up my recents folder especially if I have been working on a number of different apps.

My question is: how do I make sure that only the application itself can be viewed in the recents folder and not some of its content files as well. If so, how would I do this? Is it possible to do when creating the application itself?

  • The worst possible solution but may work. Set up a Folder Action that changes the permissions of the contents to write only. Jul 30, 2018 at 19:22
  • @JBis Thank you for the suggestion! However, I'm afraid that whilst this would probably work, I was hoping that maybe there could be something done the the application itself i.e. without requiring the execution of another command outside of the application itself. Thanks once again.
    – Tom
    Jul 30, 2018 at 19:26
  • You need like a Spotlight Exception wild card; Jul 30, 2018 at 19:31
  • May have slightly better solution. What directory do you save your AppleScripts to usually? Jul 30, 2018 at 19:32
  • @JBis My AppleScripts are stored in a subdirectory in my Documents folder. What would your suggestion be?
    – Tom
    Jul 30, 2018 at 19:37

1 Answer 1


The following answer will add a .metadata_never_index file inside the Application folder. This will prevent indexing by Spotlight of the folder hopefully preventing it from appearing in Recents.

Here's the script. Save it to /Library/Scripts/Folder Actions Scripts/:

on adding folder items to theFolder after receiving theNewItems
    --  Called after items have been added to a folder
    --  theFolder is a reference to the modified folder
    --  theNewItems is a list of references to the items added to the folder 
    repeat with myItem in theNewItems
        tell application "Finder"
            if myItem's name extension is "app" then -- make sure its an app
                set myPath to the POSIX path of myItem
                do shell script "touch " & quoted form of (myPath & ".metadata_never_index")
            end if
        end tell
    end repeat

end adding folder items to
  1. Navigate to the folder where you save your Apple Scripts

  2. Right click on that folder and select Services>Folder Actions Setup

  1. Select the script that saved and click Attach

  2. Make sure Enable Folder Actions is checked in the upper left

  3. Test.

  4. Celebrate!

  • Thank you for you excellent answer! Whilst is isn't necessarily what I had in mind (i.e. doing something to the app itself to prevent this in the first place) it definitely is a perfectly acceptable solution for the overall. Thanks!
    – Tom
    Jul 30, 2018 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .