How To Lock A Folder On Mac

In this digital era, privacy and security are critical. For Mac users, protecting your files from unauthorized access is paramount. In this article, we will guide you on how you can lock a folder on Mac.

Using Disk Utility to Create an Encrypted Disk Image

One reliable way to lock a folder on your Mac is by creating an encrypted disk image using Disk Utility. Here is a step-by-step guide:

  1. Open Disk Utility from your Applications’ Utilities folder.
  2. Select File > New Image > Image from Folder.
  3. Choose the folder you wish to lock and click Open.
  4. In the Image Format section, choose “read/write”.
  5. In the Encryption section, choose “128-bit AES encryption” or “256-bit AES encryption”.
  6. When prompted, create a password. Don’t forget to uncheck the Remember password (add to keychain) option.
  7. Choose where to save your encrypted disk image, then click Save and Done.

Now, every time you want to access your files, simply open the disk image and enter your password.

Using Terminal to Lock a Folder

If you are comfortable using Terminal and want a quicker way to lock a folder, follow these steps:

  1. Open the Terminal application.
  2. Type the following command and press Enter:
                chflags uchg /path/to/folder

    Replace “/path/to/folder” with the correct path of the folder you want to lock.

To unlock the folder, use this command:

            chflags nouchg /path/to/folder

Again, replace “/path/to/folder” with the correct path of the folder you want to unlock.


Both methods outlined above can help you lock a folder on Mac effectively. Remember to always keep your password safe to prevent losing access to your files.