I accidentally deleted a bunch of Unix Executable Files on my Mac when I was using some cleanup tool and now there's no way I could restore those files using that app.

But I have them all in my trash folder and I'm wondering if there's a way to locate where the files originally were so I can manually put them back

Some of them are really obvious, like Dictionary is in Contents » MacOs, but for some other files like AdjustmentsPlugin, or DUSupport I have no idea where they were.

Is there an app I can use to locate Unix fils? Since I have another Mac I can just look for the files there. Spotlight doesn't really look for Unix Executables.

  • 1
    Can you tell us which cleanup tool you used and give us a few more examples from your Trash? Can't you just go to the Trash, right click, and select Put back…? – slhck Jul 25 '12 at 18:50
  • I was using Xslimmer and it deleted a bunch of executable files. I don't think mac has an option to restore files from trash though... but my problem is now fixed. I looked up the file locations on another computer and put them back manually. – pew007 Jul 25 '12 at 19:35
  • 1
    Oh, alright! In a few hours, you can answer your own question (using the button below) and tell us exactly how you did it — that'd help others with the same problem. – slhck Jul 25 '12 at 19:41

Have you tried the locate command from a shell prompt? Assuming the locate database has not yet been rebuild that should show you the old location of the files.

  • is there a suffix for those unix executable files? when I use the locate command it just says unknown0021e9e64f1a:~ Home$ locate Dictionary WARNING: The locate database (/var/db/locate.database) does not exist. To create the database, run the following command: sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist Please be aware that the database can take some time to generate; once the database has been created, this message will no longer appear. – pew007 Jul 25 '12 at 17:12
  • 2
    @newbie: Unix executable files generally do not have a filename extension. On conventional Unix/Linux systems they are likely to be found in directories named bin (or sbin). – RedGrittyBrick Jul 25 '12 at 17:22
  • That means you succesfuly found and ran the locate command. Unfortunately the database its gets its information from is empty. You can create suces a DB with the command you listed (sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist), but that would only generate a database with the current location of the files (e.g. int he recycle bin). I was hoping to use the location from an old database. (Most unix systems update such a DB weekly or even nightly. I guess the defaults on OS/X differ). – Hennes Jul 25 '12 at 17:32
  • That link to locate is broken. – Basil Bourque Sep 17 '17 at 22:30
  • That is the downside of external links. It used to work. I replaced it with a new (currently working) link. – Hennes Sep 18 '17 at 12:06

One option would be to use Spotlight:

mdfind 'kMDItemContentType==public.unix-executable'

It seems to exclude files inside application bundles though. And it doesn't include files with an extension like .sh or .rb even if they were executable.


Executable files have the executable bit set ( think chmod +x )

This is easily detectable by the tools that come with the operating system:


GetFileInfo #if you have the Developer Tools installed

Extended attributes ls -l@e

Now you just need a way to recurse into the filesystem, to find files which are executable:


works if you like bash

Fire up zsh and you can use this:

print -l ${^path}/*(-*N)

To print , one per line , everything in your $PATH, which is an executable file

Run this as root of course, to get into all the nooks and crannies of the system.

Spotlight won't search anywhere that is hidden from you ordinarily.


This is the hard way, because in the finder, there is an option to "put back" files in the trash, which means there is metadata about where the files came from.

Regardless, if all the files are in the trash, then you just need create your list of paths, and make your system fit.

Actually, this is a job for Radmind, which is a tool used to bring a system into correspondence with a reference system... but you could also just re-install the OS, in place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.