Encrypt Folders with Password Protection in Mac OS X the Easy Way

Aug 12, 2012 - 56 Comments

An encrypted and password protected image in Mac OS X can be created through Disk Utility

Encrypting folders and requiring passwords for access is an excellent way to store and protect private data on a Mac. Now, there is a new means of password protecting folders and sensitive files introduced in Mac OS X that lets you create a new encrypted disk image directly from a specified folder.

Though you can still create a blank disk image and fill it as you see fit by using the older trick, this new option in Disk Utility is easier to use and extremely quick, making it the preferred method to add a very strong layer of encryption to a folder, securing itself along with all of its contents.

How to Encrypt a Folder in Mac OS X

This specific “Image from Folder” trick requires a modern MacOS release, anything from Mac OS X 10.8 or later will have this as an option to use:

  1. Open Disk Utility, found in /Applications/Utilities/
  2. Pull down the “File” menu and select “New” and then “Disk Image from Folder”
  3. Create New Disk Image from Folder in Mac OS X

  4. Navigate to the folder you wish to turn into an encrypted drive and click “Image”
  5. Set the Image Format to “read/write” and the Encryption to “128-bit AES”
  6. Creating a new encrypted image out of a folder in Mac OS X

  7. Choose a strong password (or generate one by pressing the black key icon) and – this is important – uncheck the box saying “Remember password in my keychain”, then click OK

Setting password protection for the encrypted folder in Mac OS X

If you do not intend on using the encrypted image as a working folder that you can add and remove documents from, you can choose an Image Format other than “read/write”.

An encrypted disk image will be created based on the folder you specified, it may take a while if the folder is large or your Mac is slow.

Accessing the Encrypted Folder & Contents

After the encryption procedures is finished, you’ll now be able to access and use the encrypted folder. To summarize steps of accessing the encrypted folder and how to properly use it to maintain security:

  • Open the encrypted folder image with a double-click, treating it as a normal disk image
  • Enter the password used during the initial encryption setup – do NOT check “Remember password”
  • Accessing the encrypted folder in Mac OS X requires a password

  • Access the encrypted folder and the contents as a mounted virtual disk, you can modify, copy, edit, delete, and add to it
  • When finished, close the files and eject the virtual image to re-secure the folder and files and require a password for future access

You will want to locate the encrypted dmg file and store it somewhere accessible enough, since you will be using a double-click to try to mount the folder image in the Finder when it needs usage, and of course you will need the password to access the files.

Just as when creating the disk image password, always uncheck the box saying “Remember password in my keychain” or else you will store the password and lose the security benefit of the encrypted image since anyone with access to your user account could open it. This also applies to transferring the encrypted folder image to another Mac.

With a readable and writable encrypted disk image, you can treat it as a normal folder and copy, delete, or move files from the image. Anything brought into the image while mounted will become encrypted automatically under the same protective layer with the same password.

When you are finished working with the folder and want it password protected again, simply unmount the disk image.

Regaining access again will require the password before it can be mounted and available.

The short video below demonstrates the entire process, in less than a minute you can encrypt a folder with password protection and mount it for access.

Remember, do not forget the password, or else you will lose access to the data stored within the encrypted folder for good. This is important, because the security level of the encryption format is so strong that it’s virtually impossible to break, thus a lost password means lost data.

Note: This will only encrypt and password protect the folder specified, if you are looking for full disk encryption for literally every single thing on the Mac, you would want to enable FileVault instead. FileVault applies similar encryption methodology to the entire hard drive automatically.


Related articles:

Posted by: William Pearson in Mac OS, Security, Tips & Tricks


» Comments RSS Feed

  1. Jack says:

    Creating the encrypted disk image works fine. But, you are creating a new folder, not encrypting the present one. So, if you want to keep the contents private you’ll need to trash the old folder.

  2. Melissa says:

    I’ve completed all the tasks however I’m never prompted to enter a password to access the disk image, after it’s created.
    I’m prompted, and I enter a password to use during the creation process. But that’s the last I see of it.

    • Ablo says:

      You saved the password to your keychain, you are not supposed to save the password to your keychain otherwise it won’t ask for the password when you open the encrypted image. You’ll need to ‘forget’ the password, then when entering it again, do not check the box to save the password.

      • soph says:

        In Mojave the option not to save in the Keychain does not exist. Kinda negates the use of an encrypted folder. Some steals your note and your password and can then decrypt all your documents. Groan!

  3. Rohit says:

    i want to ask the same question as nagash asked ! anyone there ?

  4. nagash says:

    I followed the instructions and created the secure folder, but… when I mount it, the folder appear as READ ONLY and I can’t modify the content. anyone knows why it happens? And yes, I selected image format: read/write :\

  5. Brian says:


    Can anyone please tell me how to change the password of an encrypted folder/ password protected folder.


  6. Lia says:


    i followed all the steps and everything worked perfect for me, i was able to put in my password and see the content. and everything.., now, couple weeks later i cannot access the folder. i put the right password and the folder does not mount on the desktop! it keeps asking me to introduce the password. it doesnt even say it is incorrect! how can i open my folder. i am not gonna be able to access my stuff ever??

    please help


    • tyrgn says:

      Unmount the disk image and remount it, be sure to enter the proper password. Unless the file was somehow corrupted (by a drive failure or otherwise) it makes no sense for the image file to suddenly reject a correct password.

  7. Graham says:

    I wonder if anyone can help. I’ve created a .dmg file from a folder. It’s stored on an external hard drive. The problem I’m going to have is that the .dmg folder opens onto my desktop but the SSD drive on my Mac is getting full and the .dmg folder will soon be larger than the free space on the MacBook. Can I set the .dmg folder to open on another external drive instead of the MacBook? If so how? Cheers

  8. INEEDHELP5 says:

    I did all of this awhile back and i forgot my password… is there anyway to recover the file at all?

  9. SB says:

    Question, I created an encrypted file about a year ago and used to access it by typing the file name in spotlight. I have now forgotten what the file was name and can’t find it. Is there an easy way to view all encrypted files? I remember the password so once I find it I should be able to open it just fine. Thanks!

  10. Amy says:

    I’ve gone through the process in the tutorial step-by-step, several times and it all goes fine. Once the dmg and disc image were created, I copied my files over, unmounted the disc image, then re-opened the dmg. Click on the disc image, and it opens, no password required. I’m running OS X Yosemite. Help!

  11. Gertone says:

    I have a tremendous problem. I created a .dmg in order to put some special stuff in there. It had a strong password, but today I tried to open it and it says that the password is wrong. I don’t know where this come from. The password I’m using is the correct one… I need those files so bad. What can I do?


  12. josh says:

    so i made one but when i put things into the trash it dosent let me delete it says. “The operation can’t be completed because you don’t have permission to access some of the items.”

  13. razz says:

    Upon trying to create the image with the encryption I receive a message saying: “Unable to create “Storage B.” (Permission denied)” Any idea what is wrong?

  14. Cris says:

    I was able to create and mount the DMG, but I can’t move anything into it, even though the sharing and permissions on the DMG say I can read and write. When I’m in the mounted drive in Finder, it won’t let me create a new folder in it. Any suggestions?

  15. Scott says:

    Im mediocre with computer terms so dont kill me:

    I made a ‘disk image from folder’ called “Scotty’s Folder” and placed the link into another folder “Business Folder”.

    In order to access “Scotty’s Folder” I had to:
    1)Open Business Folder on desktop
    2) double click blahblahbah.disksparseimage (or something like this)
    3)enter password
    4)Then “Scotty’s Folder” appeared

    …..But I recently deleted “Business Folder”. I my secret “Scotty’s Folder” gone?!?

  16. Sam says:

    I’ve used this to make an encrypted file… however when I try to add more files to the encrypted folder it doesn’t work… theres not enough room.

    anyone know how I can add to my encrypted file or make it larger? i just want to avoid having to redo this process every time i want to add to the file.


  17. Eugene says:

    This works great with one exception. It appears that anyone can delete the DMG file even if they can’t access it. So if the point is to protect it not only from other users accessing it but also deleting it then this doesn’t work. Any suggestions? I have one user name and other user occasionally use my computer. Even though they couldn’t see the contents in the directory with the password they could drag the image file to the trash and empty it.

    Would love any advice.

  18. Manas says:

    this is very very helpful in keeping privacy and very good. this can actually lessen your burden if you have any doubt that someone might see your files.

  19. Chris Q. says:

    You cannot use a crypted folder that way since you cannot add new files to the folder. The folder size is fixed and CAN’T BE EXPANDED.

    • Matt says:

      You can add new files to the encrypted folder by unlocking the DMG and then copying files to it. If you intend on placing a lot of files in there, make sure to account for the growth in file size when creating the original disk image. You can also use Disk Utility after the fact to resize an image if necessary.

      You can think of the encrypted disk image folder as a little virtual hard drive partition, it is set in size just like a partition but can be shrunk or expanded if necessary.

  20. Kris says:

    This is a terrific tutorial. I’ve been looking for a simple tool to encrypt work files, and this is it! I’m so happy I don’t have to download some application… Thank you!

  21. Henry says:

    Hey what am I doing wrong. I followed all the instructions to password encrypt a folder on my Mac It creates the dmg folder, but when I click on the dmg folder it does not open & as for password. IT actually does nothing. WHat did I do wrong ? Also can you use the same process to change the password on a protected folder.


  22. Phil says:

    This article is very interesting! However, beside “Documents” folder, how we can put security password to another folder? Thanks.

  23. ThomasYH says:

    Ok. so if i make disk image and place it on my desktop. I use it for a wile. Then i want to delete it/ free the space from my computer. How do i delete or free the reserved space? Do i only drop the disk image in the trash? Does that free my hard drive from the disk image? Or does it only delete the img and the space is still reserved on my hdd??

  24. Francis says:

    I have been using encrypted disk image for long time; since OS Leopard. And I have no problem with it. Currently I’m using OS Mountain Lion and now I have problem with it. The Encrypted disc image which is created in this latest OS becomes so slow when I copy files to it. Does anybody have experienced this problem? Does anybody know what is the problem and how to solve it?


  25. Brian H says:

    I wonder why nobody uses an encrypted ZIP file from terminal anymore.

    Just use this syntax:

    zip -erm folder.zip folder where folder is the files you want to encrypt.

  26. Lamar J says:

    Strangely, I noticed once this is done, I cannot delete files inside the new dmg.

    Yes, I have opened the .dmg using the password. Yes, I have checked permissions and have read/write access.

    Like Dan as said I recommend using the sparse bundle. I have had success with this method, strangely I think it is easier and it is expandable and more importantly, shrinkable. Back to the old way.

  27. Paul says:

    Errrr….the title of this article says “…the Easy Way”. This is not easy. I have, for so long, wished theat crappy old Mac OSX would have a “right-click, select “encrypt folder”” option. Type in a password…the folder’s encrypted. To open it, you’re prompted to type in the password again. Is this beyond the capabilities of Apple programmers? Apparently so.

    • Lincoln Sills says:

      Are you reading what you are writing? You, in a very condescending manner, trash the post saying “This is not easy”, and then you trash Apple saying they are incapable of encrypting a file…but it’s right there in front of you AND this is easy. LOL That is the most ironic post I have ever read here.

      • Richard says:

        Actually, he’s right. This whole thing could be made much easier and user-friendly. It’s a case of Apple dropping the ball, or, more likely, correctly assuming the bulk of its users are typically Homers who use iPhoto and Twitter but don’t bother with more arcane and complex operations.

        If Apple wants to use some of its great wealth to simplify and streamline the process, the clunky Disk Utility should be removed from the equation. Additionally, little clumsy infelicities need cleaning up.

        For example, it’s simply stupid to have to unclick the option to store the pw in one’s keychain every single time. How many times must I tell OS X this?

        Additionally, you can’t see the password you’re typing as you create the encrypted file — an option to do so is only there when you decrypt. Again, this is too clever by half, since it’s obviously meant to hide the pw from prying eyes. But what genius at Apple decided only encryption, and not decryption, should be sooper-sekrit? Or as you would put it: LOL.

  28. Robert says:

    All goes well to the point where I click on the newly created .dmg (i.e. 0.56 secs on your video).
    It ‘flashes’ but the box asking for the password does not appear so basically nothing happens and can’t proceed.
    Obviously done something wrong but not sure what.

  29. smrt says:

    I had an idea to encrypt whole home directory. I created a new user “encuser” account, then I created an encrypted dmg image. I mounted it as root user by commandline “sudo hdiutil mount -mountpoint /Users/encuser”.

    I swtiched user to encuser and it worked as I expected. However, when I was using the “encuser” acount for some time I realized, the encrypted disk was lagging. I/O time to time idled for even 10 secs. It was so much laggy so it was useless. Am I doing something wrong? On linux I can mount encrypted partition (or loopback file) and use it as my home directory with no problems. Why isn’t this possible on Mac?

    I also realized, when I had logged-out the user some of his processes were still runing. I had to “killall -u encuser -9” to be able to umount the imege. WTF?

    • Jeb says:

      The built in File Vault feature turns the home directory into an encrypted disc image that is mounted and unmounted automatically.

      • Dan says:

        This is only true of Snow Leopard. Lion and ML use Filevault2, which uses whole disk encryption, not just the Home folder.
        Making your Home folder encrypted is a pain and causes numerous admin problems for OSX processes. Either turn on FileVault or use an encrypted image for your Documents. Don’t try to do it yourself; even Apple decided it wasn’t very good.

      • smrt says:

        I can’t use FileVault since several people use my iMac. If I use FileVault all of them would have access to the whole disk.

        Btw, there is a very basic security problem with dmg encrypted images. Consider your mac is confiscated in UK. They found encrypted *.dmg file on your disk and because of the law in UK they force you to reveal the password (keeping you in jail). You have a same problem with FileVault. IMO, truecrypt is much safer since there is no way how to prove the file named “random-data.dump” is encrypted disk image.

  30. Aberto I says:

    Good trick!
    The problem is that if you create a dmg from a folder of 10MB, the dmg has a maximum capacity of 10 MB and it is not expandable, and so it is not possible to add new files to the dmg.
    Or is there a way to do that?

    • Dan says:

      No. The Create From Folder doesn’t let you do that. For an expanding disk image, you need to create a New Disk Image and specify the type as Sparse Bundle. You can choose to encrypt this and then you can copy stuff in to it. It will resize the image to hold the data.

  31. B30 says:

    Of course, you have to trash the original folder, otherwise it would be pointless. You don’t have to un-encrypt the dmg (you do know your password, right), just mount that thing, drag and drop your data out of it wherever you want it (erase it on the dmg, if this is what you want) and you’re done.

  32. Guy says:

    Okay, I’ve created an encrypted .dmg. The password works to mount a disk image. Great.

    But the original folder is still there will all the content, and this original folder is NOT encrypted!

    Am I supposed to trash the original folder?

    Also, how do I un-encrypt the .dmg file?

    • B30 says:

      Of course, you have to trash the original folder, otherwise it would be pointless. You don’t have to un-encrypt the dmg (you do know your password, right), just mount that thing, drag and drop your data out of it wherever you want it (erase it on the dmg, if this is what you want) and you’re done.

    • Mark says:

      Agreed. I would think the target folder’s contents would be placed in the image. Why else go to the trouble of making this “from a folder?” Space issues are not good either. Wouldn’t you expect to need a folder larger in the future than it is now? I will make a fresh encrypted image from Disk Utility, as I don’t understand how it is any advantage to make it modelled on a folder.

  33. Pbando says:

    Im just wondering what if I put the dmg to dropbox, this way i would able to store my company files securely in dropbox.

  34. Chris says:

    Getting back on topic briefly :-)

    Actually this is not new in Mountain Lion: works also in my Snow Leopard system, and I’m pretty sure it goes way back to the earliest days of OS X.

  35. Aaron says:

    Good one Faraz! Since we’re venturing off topic, how do I get my Apple to grow fruit?

  36. faraz says:

    How can put an icon for folders as a default ? it means when I want to create a new folder , this icon come out!
    for mac!!:|

Leave a Reply


Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks


iPhone / iPad



Shop on Amazon to help support this site