MacOS – Recovering from Accidental Deletion of System Framework

finderhigh sierramacmacos

I accidentally deleted AddressBook.framework. Now when I restart my iMac the system can't load this framework thus nothing is working.

I have a bootable disk of macOS Sierra but going to recovery mode and installing macOS Sierra is not possible because downgrading High Sierra isn't allowed.

Formatting my disk will result in losing all my files because I don't have a Time Machine backup.

How can I restore AddressBook.framework to get my system working again.

enter image description here

Best Answer

Usually you would have to reinstall High Sierra in Recovery Mode. If you don't have access to another Mac running High Sierra locally and with limited download quota do the following:

  • Ask someone to upload High Sierra's AddressBook.framework as zip somewhere (e.g. a file sharing host) and submit the download link.

  • Boot to High Sierra's Recovery Mode.

  • Open Terminal and disable SIP (which should be disabled anyway or you wouldn't have been able to delete the framework).

  • Quit Terminal and open Safari. Enter the download link and save the zip file to /Volumes/< main_volume_name>/System/Library/Frameworks/

    Alternatively (if the link doesn't allow to choose a download location, which can occur on some file sharing hosts) open the Preferences in Safari and set in General > File download location > "Ask for each download":

    enter image description here

    Then save the file to /Volumes/< main_volume_name>/System/Library/Frameworks/:

    In the example below the name of the main volume is System. Your main volume name may be different (e.g. Macintosh HD or macOS).

    enter image description here

    enter image description here

  • Open Terminal and enter:

    cd /Volumes/<main_volume_name>/System/Library/Frameworks/
    

    Depending on your Safari settings the zip will be unzipped automatically after the download and the next two steps (unzip/rm) aren't necessary!

    /Volumes/<main_volume_name>/usr/bin/unzip -a AddressBook.framework.zip
    rm AddressBook.framework.zip
    
  • check codesigning:

    codesign -dv --verbose=4 AddressBook.framework
    

    if this step fails delete AddressBook.framework and get a proper one.

  • Check the restricted flag:

    ls -laO AddressBook.framework
    

    which should show for . (the dot: . is the "bundle/package" AddressBook.framework here - the date will be different of course):

    drwxr-xr-x    7 root  wheel restricted 224 Sep 25 21.59 .
    ...
    

    (You may have to add the restricted attribute to AddressBook.framework later if it's missing)

  • (Enable SIP) and reboot.