How can I delete files in recovery mode using Terminal on my OS X main partition?

Boot into recovery mode, mount volume, and open Terminal

  1. Boot to recovery mode by holding CommandR right after starting your Mac before the Apple logo appears.

  2. Go into Disk Utility and check that your target disk volume is mounted. Mount it if it's not already mounted.

  3. Close Disk Utility, and open Terminal from Utilities menu.

Removing files from Terminal

Enter cd /Volumes then ls to list all mounted volumes.

Enter, e.g., cd Volume_Name/Users/<username>/path/to/parent_directory with parent_directory being the directory containing the target directory you want to delete.

Be careful, as you have nothing restricting you from deleting required system files! Unless otherwise necessary, you should only delete files from your home directory (/Volumes/<Volume_Name>/Users/<username>/)

Example: If you want to delete a folder "xyz" in "Macintosh HD" (the example name of your main volume) enter cd "Macintosh HD/Users/username", replacing username with your user name.

Then enter ls again to list all files and directories to be sure that you are in the correct working directory.

Then enter rm -r folder_to_delete or rm -rf folder_to_delete

  • -r: Removes a folder and its content recursively.
  • -rf: Removes a folder and its content recursively, attempts to remove the files without prompting for confirmation, regardless of the file’s permissions, and ignore any errors.

Example: If you want to delete a folder "xyz" and all containing files and folders enter: rm -r xyz