Lock any folder on your Mac behind a password — built entirely on macOS's own
encryption (hdiutil). No installer, no dependencies, no account.
A folder is either open or locked — never both. Locking seals it into
an encrypted Name.flock file and removes the original folder; unlocking
reverses that exactly, deleting the .flock file and restoring the folder.
[ folder ] --lock--> [ Name.flock ]
[ folder ] <--unlock-- [ Name.flock ]
No cryptography was hand-rolled: lockfolder calls
hdiutil create -encryption AES-256 — the same tech behind encrypted macOS
backups — and applies macOS's own padlock icon to the result via
NSWorkspace, so a locked file is visually obvious in Finder.
- Download this repo — either
git cloneit, or click Code → Download ZIP on GitHub and unzip it. - Open Terminal and go to the folder:
cd ~/Downloads/fLock-main # or wherever you put it - Make the scripts runnable:
chmod +x build.sh lockfolder tests/test_lockfolder.sh - Build the app:
This creates
./build.shfLock.appright there in the folder. - (Optional) confirm it actually works:
Should print
./tests/test_lockfolder.shPASS. - Move it somewhere permanent:
mv fLock.app ~/Desktop/ - First launch: double-click it (or drag a folder onto it). macOS will say it's from an "unidentified developer" — right-click the app → Open → confirm. This only happens once.
- Lock: drag a folder onto
fLock.app→ set a password → the folder becomesName.flock. - Unlock: drag
Name.flockontofLock.app→ enter the password → it becomes the original folder again, with "Reveal in Finder" on offer. - No drag? Double-click
fLock.appwith nothing dropped on it — it asks "Lock a Folder" or "Unlock a File" and opens a normal file picker. - Terminal, no GUI:
./lockfolder lock <folder>/./lockfolder unlock <file.flock>.
| File | What it is |
|---|---|
lockfolder |
The actual logic — bash + hdiutil + a small AppleScript snippet for the icon. Works standalone. |
fLock.applescript |
Source for the GUI wrapper (drag-and-drop, dialogs, file pickers). |
build.sh |
Compiles fLock.applescript into fLock.app, bundles lockfolder inside it, applies the icon. |
tests/test_lockfolder.sh |
Round-trip self-test: locks a folder, unlocks it, checks the contents match. |
Run the test after any change to lockfolder:
./tests/test_lockfolder.sh
Works on any Mac — Apple Silicon or Intel, any recent macOS. Copy just
fLock.app to another Mac (or send the zipped .app) and it works
unchanged; each new Mac shows the same one-time "unidentified developer"
warning on first launch.
Does not work on Windows or Linux — it relies on macOS-only tools
(hdiutil, AppleScript). On Windows, BitLocker To Go is the closest native
equivalent.