How To + Recommended

How to Use Apple’s Built-in Features to Encrypt Files and Folders

Posted on April 15th, 2020 by

The best way to protect your data is to encrypt your files, ensuring that, even if they get into the hands of hackers or cybercriminals, no one can access your personal data. macOS provides a suite of tools to protect you, and, in this article, I’ll discuss the many ways you can use built-in macOS features to provide unbreakable encryption. (Unbreakable with current computing power; it’s possible that future super-computers will be able to break the military-grade encryption algorithms that macOS uses.)

I’ll explain how to encrypt your startup disk with FileVault; how to encrypt other disks; and how to create encrypted disk images to store files securely in the cloud or send by email; and how to encrypt PDF files.

Encrypt Your Startup Disk with FileVault

When Apple first added FileVault to Mac OS X in 2003, the feature was clunky, and slowed down Macs, and I didn’t recommend using it at the time. But over the years, Apple has improved FileVault. Now in its second iteration – FileVault 2 was released in 2011 – FileVault is secure and doesn’t noticeably affect the performance of your Mac. While there were good reasons to avoid the first implementation of FileVault, there are no reasons to not use it any more.

FileVault provides full-disk encryption: when it is active, every file you write is encrypted to your drive. No one can access that drive, or even start up your Mac, without the FileVault password. And if someone removes the drive and attempts to access the files it contains, they won’t be able to. FileVault uses uses XTS-AES-128 encryption with a 256-bit key; that’s a simple way of saying that it is extremely robust.

In addition, FileVault 2 allows you to use Find My Mac to remotely erase your drive if your Mac is lost or stolen. And if you decide to sell, give away, or destroy your Mac, you don’t need to worry about securely erasing the disk. Since it is password protected, anyone who recovers the disk will not be able to access your files. It’s a good idea to erase it anyway, but there is no longer a "secure erase" feature for SSDs on macOS, so it’s really important to use FileVault on an SSD.

Activating FileVault

To turn on FileVault, go to System Preferences > Security & Privacy, unlock the preference pane by clicking the padlock and entering your administrator’s user name and password, then click FileVault.

Click Turn On FileVault. By default, your login password unlocks the disk, but if you forget that, you need another way to access your data. You are asked whether you want to be able to use your iCloud account the unlock your disk if you forget your password, or if you want to save a recovery key.

If you use your iCloud account, you won’t need to worry about saving anything. The recovery key is a string of 20 characters, such as TH3E-T829-ELOW-34BD-LMJ9.

However, if you store your recovery key on your iCloud account, you’ll need access to that account to unlock your disk. So if you don’t have internet access, you won’t be able to unlock the disk. And if, perchance, you get locked out of your iCloud account, then you could be in trouble.

If you do opt for saving the recovery key, you will need to save it securely. You could store it in a password manager, or print it and save it in a secure location, such as a safe deposit box. If you do choose the recovery key, you can double-click it in the dialog, copy it, and paste it into a document. Or, you can take a screenshot and save that. (To take a screenshot of your Mac’s screen, press Command-Shift-3. The screenshot is saved to the Desktop.)

Whichever option you choose, click Continue. If you have multiple user accounts, you’ll see a dialog asking you to allow each user – other than your account – to be able to unlock the disk.

You don’t have to enable other users, but if you don’t, they’ll need you to unlock the disk when your Mac starts up.

Click Continue, and FileVault will begin encrypting your disk. Note that your computer must be connected to power for this to work; if you disconnect a laptop from its power source, FileVault will pause until it is reconnected.

The initial encryption will take from a couple of hours to a couple of days, depending on the size of your disk, and SSDs will encrypt more quickly. However, any new files you create or download are automatically encrypted during this period. It can seem like a long time, but you can continue working with your Mac, and you won’t notice much of a performance hit as FileVault does its initial encryption.

You can turn off FileVault at any time in this preference pane, and if you wish to change your recovery key, you’ll need to turn off FileVault and turn it on again.

Encrypting Other Disks

macOS offers a similar feature to encrypt external drives, or any drive that you connect to your Mac. For example, if you use a thumb drive to shuttle files between home and work, it’s a good idea to encrypt it in case you lose it.

Encrypting Empty Disks

To do this, mount the drive, then open Disk Utility (it’s in the Utilities folder in your Applications folder). Select the drive, then click Erase in the toolbar.

In the Format menu, select either Mac OS Extended (Journaled, Encrypted), or APFS (Encrypted). You’d choose the latter if you want to be able to boot from the drive; if not, choose the former.

Enter a password, then enter it again. It’s a good idea to enter a password hint. Click Choose, then click Erase. Disk Utility will erase the drive and create a new encrypted drive; any files you write to that drive will be encrypted, and when you mount it on a Mac, you’ll need to enter its password. You can, however, choose to store the password in your Mac’s keychain, but you probably don’t want to do this on any Mac that doesn’t belong to you, such as one in your office.

Encrypting Disks Containing Data

If you have a drive that already contains data, and you don’t want to erase it, you can still encrypt it, but not in Disk Utility. Mount the drive, then right-click it in the Finder, and you’ll see an Encrypt option.

Choose that option, then enter and verify a password, and enter a password hint (it’s required here). If you click the key icon, you can have macOS suggest a password.

The Finder will unmount your drive, and it may take a few minutes for it to be remounted, and the encryption process may take some time, as with FileVault.

Encrypt Time Machine Backups

If you use Time Machine to back up your Mac, you have the option to encrypt the drive you use for backups. To do this, you need to choose encryption when you set up your disk for Time Machine. If you are already using a disk with Time Machine, you can stop using it, turn on encryption, then add it again.

Open the Time Machine preference pane (in System Preferences). Click Add or Remove Backup Disk. Choose a disk, and check Encrypt Backups at the bottom of the dialog.

If you want to turn on encryption for a disk you’re already using, select that disk, then click Remove Disk. Click Select Disk in the Time Machine preference pane, select that disk, then click Use Disk; make sure to check Encrypt Disk.

No data is lost when you do this with a local disk, but if you’re backing up to a network drive, then your backups will be erased, so it’s best to ensure that you have a full backup of your Mac before making this change.

Store Files on an Encrypted Disk Image

Another way to encrypt files is to store them on an encrypted disk image. A disk image is a special file that acts as a container for other files; you can create one that is encrypted, so the container and all its contents are protected. Encrypted disk images let you store files securely on cloud servers, and you can even use them to send sensitive files via email. Just give the receiver the password – by telephone or secure messaging – and they’ll be able to open the disk image and access the files, or add their own files to it.

To do this, open Disk Utility, and choose File > New Image > Blank Image. (If you want to take a folder and create an encrypted disk image with its contents, choose File > New Image > Image from Folder, and select the folder you want to use.)

Enter a name for the disk image file in the Save As field, then you have a number of options at the bottom of the dialog.

  • Name: This is the name of the disk image that mounts in the Finder, rather than the name of the actual file. Enter anything you want here; you’ll only see this name when the disk image is mounted in the Finder.
  • Size: Enter an appropriate size. You may only want this disk image to store a handful of documents, so perhaps 10 MB might be enough. But if you want to put a lot of files on it, maybe you want it to be 1 GB. If you’re not sure, see below in Image Format for other options.
  • Format: Choose Mac OS Extended (Journaled), or, if it’s only going to be used with Macs running macOS 10.13 or later, choose APFS.
  • Encryption: Choose 256-bit encryption. It’s more secure, and, while Disk Utility tells you that it’s slower, you generally don’t need to worry about speed unless your disk image is huge. You’ll be asked to set a password at this point.
  • Partitions: Choose Single partition – GUID Partition Map.
  • Image Format: If you’re not sure of the size you need, choose sparse disk image. Disk Utility will set its size to 100 MB, which is the maximum size for the disk image, but you can go back to the Size field and enter another size, such as 1 GB, or even 1 TB. A sparse image is a special format that will grow as needed until it reaches that maximum. The initial disk image file will be very small – about 7.5 MB – but will grow as you add files to it.

Sparse images are the best option when you don’t know what you want to store on the disk image. When you add files to a sparse image, the size of the disk image file increases. When you delete files, however, the disk image file doesn’t get any smaller. There is a way to compact sparse images. If you are familiar with Terminal, you can run this command:

hdiutil compact <disk path>

Type the first two words in Terminal, then drag the disk image file to the Terminal window and press Return. You’ll see something like this:

$ hdiutil compact /Users/kirk/Documents/My\ Disk\ Image.sparsebundle
Starting to compact…
Reclaiming free space…
...............................................
Finishing compaction…
Reclaimed 772.8 MB out of 948.2 MB possible.

Print to PDF

You can also encrypt PDF files, using macOS’s built-in print to PDF option. This works for any type of file you can print on macOS.

PDF options display in the Print dialog; so press Command-P, or choose File > Print, to display the Print dialog. At the bottom left of this dialog is a PDF button; click it to display it’s menu, and choose Save as PDF, then click Security Options.

In this dialog, you can set a password to protect the PDF from being opened, to protect its content from being copied, or to prevent it being printed.

You can also protect an existing PDF. Open it in Preview, which is the default app on macOS for PDFs, then choose File > Export, check Encrypt, and enter a password.

Summing Up

With all these options, you can safely encrypt your disks and even create encrypted disk images that you can send via email, store in the cloud, or save on network servers. Your data is protected by encryption algorithms that are robust and secure. Also, using the built-in macOS encryption features means that you don’t depend on third-party software, and these disks and files will be compatible on any Mac. Just don’t forget (or lose) your passwords.

About Kirk McElhearn

Kirk McElhearn writes about Macs, iPods, iTunes, books, music and more on his blog Kirkville. He is co-host of the Intego Mac Podcast and PhotoActive, and a regular contributor to The Mac Security Blog, TidBITS, and several other websites and publications. Kirk has written more than twenty books, including Take Control books about iTunes, LaunchBar, and Scrivener. Follow him on Twitter at @mcelhearn. View all posts by Kirk McElhearn →