I need to delete a folder otherwise my mac won't boot. How can I do this in recovery mode or whatever it's called using Terminal commands?


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

  • 4
    @2rs2ts, this did work for me but required me to go first into "Disk Utility" and mount the APFS encrypted volume. Then closing Disk Utility and opening Terminal worked as described here. (macOS Mojave) – Unapiedra May 4 '19 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .