How to Lock a Folder on a Mac?

lock folder on mac

Everybody has sensitive data with them. Whether you are a large multinational corporation or an individual with a single computer, there is always some data that you don’t want someone else to see. When you are using a computer, you have different options to prevent access to that sensitive data. One way to avoid this access on your MacBook is to create private folders on your Mac. In this article, we will tell you about the different ways that you can use to lock a folder on a mac. 

Why to Lock a Folder on Your Mac? 

Locking a folder is essentially an act of limiting access to the contents within that folder. You want to keep the data or contents inside the folder safe from prying eyes. For example, companies might want to protect the data such as financial records, passwords, maps, or employee records. Folders could also be locked to make data transfers more secure. 

Similarly, you could personally want to lock folders that contain information, photos, or videos that you don’t want others to get access to. 

There could be many reasons why someone would want to password protect a folder on their Mac. Let us show you the different ways in which you can do it. 

Lock a Folder on Mac with Disk Utility

 Let us take you through a detailed guide on how to protect your sensitive files from unauthorized access on a Mac. 

Step 1: The first step is to create a folder (on your desktop or elsewhere on the Mac) containing all the files that you want to lock. 

Step 2: Open the disk utility app. You can easily access the “disk utility” app from the Spotlight search area. Once you see the disk utility app, click on the “enter” key to open the program. 

Step 3: Navigate to the upper menu bar and choose the “file” option. 

From there, choose the “New image” option and then “Image from the folder.” A quick way to do this is to use the right mac shortcut. 

Step 4: Once the “image from folder” window opens, you now need to select the folder that you want to lock from there. 

Step 5: Once you have chosen the folder, a new window will open where you need to enter the new name that you want to give to the folder and also choose the location where you want to save it.

This is also the part where you choose the level of encryption you want. We suggest that you go with the 256-bit AES encryption. This is the most secure encryption at the moment. It won’t take a lot longer than the 128 -bit AES encryption too. 

lock mac folder with disk utility

Step 6: In this step, after you have selected the encryption, a new window will open where you can now set the password for the folder or image file. 

Step 7: Next, you need to confirm your password by selecting “choose” followed by the “Save” button in order to create the password-protected folder with the help of the Disk Utility. 

Step 8: Click on “Done” once you see that the process is complete. Open the location which you have specified for the password-protected folder, and you will now find it there. Congratulations, you have successfully locked a folder on Mac using the disk utility option. 

Using Terminal to Encrypt Mac Folders (for Pros) 

In the example below, the file we want to encrypt is on the desktop. 

Step 1: Go to the Terminal on your Mac and key in the following command 

openssl aes-256-cbc -in ~/Desktop/Photo.jpg -out ~/Desktop/Encrypted.file


openssl aes-256-cbc denotes the type of encryption. 

-in ~/Desktop/Photo.jpg denotes the file that needs to be encrypted and its location

-out ~/Desktop/Encrypted.file designates the location of the encrypted file. 

use terminal to encrypt mac folders

Step 2: After you have entered the command in the Terminal, you can provide the encryption password when asked. 

Once you have entered and confirmed the password, you can continue.

Step 3: You will be able to see the encrypted. File document on your desktop. The directory and the means of encryption can be changed according to your needs. 

Step 4: Next, to decrypt the same file, you can use: 

openssl aes-256-cbc –in -d ~/Desktop/Encrypted.file -out ~/Desktop/Photo.jpg

In your case, ensure that you change the file name and add ‘-d’ without quotes. 

That’s it; you are done. You can protect and encrypt individual files, and you can do it without using third-party software. 

Create Private Folders on Mac by Compression 

Another convenient method to protect files or folders using Terminal is by compressing the file or folder, and the password protects it. In this example, too, the file we want to compress is on the desktop. 

Open Terminal and bring it to where you have stored the file. In this example, the files are on the desktop. Hence, we type the command below. 

cd Desktop

Once you have confirmed, you have to enter the following command

zip -e photo.jpg

The above command will convert the photo.jpg into the zip file named

Remember to add a strong and memorable password. Repeat the password, and you’re all set. 

compressing to lock folder on mac

Within a second, you’ll see the zipped file in your specified location. In this case, we will find this file on the desktop. 

Now, if anyone wants to open this file or folder, they will have to put in a password. 

Note: You can delete the original file now as the same file is the same inside the zip file. 

Extra Tip

Sometimes you might find that some folders show up on spotlight search even after being locked. 

Here’s a method to get rid of that problem. You should simply add ‘. noindex’ after the folder name. For example, if the file name was ‘mysecretstash,’ change it to ‘mysecretstash. noindex’ 

This folder will now not show up in searchlight.  

Using Encryption Software

Let us look at how to lock a folder on Mac using the third-party encryption software called Encrypto. Available for download on the Mac App Store, you’ll get a better user interface and smoother experience compared to all the other methods discussed so far. 

Step 1: Start by downloading and installing Encrypto from the Mac App Store.

Step 2: Once installed, open Encrypto from the app folder or through Searchlight.

Step 3: To put Encrypto in action, drag the folder you want to encrypt to the app window. 

Step 4: Protect the folder of your choice by entering a password. There is also an option to set a hint question so that in case you forget the password, you can always recover it easily.

Step 5: Once you are done with the above, select “Encrypt” to create your archive. 

Step 6: Once the encryption is done, drag the created archive to someplace safe. You can also choose the option of “share a file” and “save as” to save or send the file wherever you want. 

use crypto to encrypt folder on mac

Bonus: How to Encrypt Files on Mac?

Password protection of folders can be done conveniently using the Disk Utility function, but you can still protect files on your Mac by using two utilities. The first one is called Notes, and the next is called Preview. We will show you how to use both apps.


When you need to protect individual files, you can do so in a few clicks with the help of the Notes app on your Mac.

Step 1: Open the Notes App 

Step 2: Select the file that you want to protect with a password

Step 3: Navigate to the Menu bar and select the ‘lock’ icon.

Step 4: Choose ‘Lock Note’.

Step 5: Enter a password for the file that you want to lock. 

Congratulations. And that’s it; you’re done. 


Please note that Preview can password protect only PDF files. If you want to protect a file other than a PDF, you will first need to export it as a PDF, and then the password protects the file.

Here is how you can lock a PDF file using Preview. 

Step 1: Click on ‘Preview’ on your Mac.

Step 2: Select the PDF file you want to lock.

Step 3: In the menu bar, select ‘File.’ 

Step 4: Choose ‘Export’.

Step 5: In the ensuing menu, check the “Encrypt” box.

Step 6: Add and verify your password.

Step 7: Select “Save.”

There are also few other apps such as Pages, Keynote, or Numbers that come pre-installed in your Mac. You can save files using the above apps by opening any one of them, selecting “File” from the menu bar, and setting a password. 


Protection of files and folders in a Mac is something that all Mac users should know as it can help them protect sensitive data from prying eyes. Everyone needs to protect their data, and these are some easy ways in which you can do so. We have discussed various ways on how to put a password on a folder in a mac in the above text, and we hope it was useful for you.