What is /Library/StagedExtensions for and how to remove extensions

时光毁灭记忆、已成空白 提交于 2020-05-24 20:26:16

问题


I'm trying to uninstall Parallels completely from macOS High Sierra. I removed everything from the disk except some Parallels extensions that are stored under /Library/StagedExtensions/Parallel Desktop.app

I think the location has to do with user approved extensions, but I'd like to find a way to remove/uninstall those too. If I try to delete the extensions it says operation not permitted despite the root rights.

Any idea?


回答1:


There is new way to clear the StageExtensions folder as following

sudo kextcache --clear-staging

This command will clear the /Library/StageExtensions folder. We dont need to go to recovery mode and delete manually this folder in case there are some permission errors while installing software.




回答2:


In my case, deleted kext disappears from StagedExtensions when you invalidate kext cache.

sudo rm -rf /Library/Extensions/Parallel\ Desktop.app # check if the name is correct so you don't delete some other kext
sudo kextcache -invalidate /
# now you should not see your deleted kext here
ls /Library/StagedExtensions/

UPDATE 2019:

See man page for full details: man kextcache. Excerpt related to -invalidate, -i for short:

 -i os_volume, -invalidate os_volume
              Rebuild out-of-date caches and update any helper partitions
              associated with os_volume.

              This option mimics sudo touch /System/Library/Extensions on
              os_volume.  If kextcache cannot find or make sense of
              os_volume/usr/standalone/bootcaches.plist, the volume is treated
              as if no caches need updating: success is returned.

There are also new options:

     -clear-staging
          Clears the kernel extension staging area by removing all staged content.

     -prune-staging
          Prunes the kernel extension staging area by removing all kernel extensions
          no longer present in their original location.

Looks like -prune-staging removes only the deleted extensions, shaving little bit of time from the next kext cache rebuild.

See https://www.unix.com/man-page/mojave/8/KEXTCACHE/ for Mojave man page, which contains these new options.




回答3:


I had a similar issue in trying to uninstall the TelestreamAudio.kext for ScreenFlow. What might be happening is that the kext in StagedExtensions is currently in use or protected while you're in regular mode. Once you get into Recovery mode, you can delete it without disabling System Integrity Protection. The following steps worked for me, though please use caution.

  • Click the  menu. Select Restart
  • Hold down command-R to boot into the Recovery System
  • Choose Disk Utility from the Recovery Menu
  • Within Disk Utility click on your main hard drive (e.g. Macintosh HD) and then click on Mount
  • Exit out of Disk Utility
  • Click Utilities in the menu bar and select Terminal
  • Use the following commands:

.

cd /Volumes/Macintosh\ HD/Library/StagedExtensions/Library/Extensions/
rm -rf NAME_OF_EXTENSION.kext
  • Close the Terminal app
  • Click the  menu and select Restart

From there on, I was able to reinstall ScreenFlow's audio kext and it worked. It may also help you completely remove the Parallels kext.




回答4:


sudo kextcache --clear-staging

Was in folder HD/Library/

Cheers

Edit: Formatting

Edit2: I believe that Parallels writes some files directly into the bootloader/kernel. After running the command from the CMD+R hold restart Disk Utility Terminal the extension was removed from /Library .

I hope this makes sense.




回答5:


This is because of the System Integrity Protection (SIP). You can disable it (not recommended) and remove the kext manually.

(from https://www.imore.com/el-capitan-system-integrity-protection-helps-keep-malware-away)

  • Click the  menu. Select Restart...
  • Hold down command-R to boot into the Recovery System.
  • Click the Utilities menu and select Terminal.
  • Type csrutil disable and press return.
  • Close the Terminal app. Click the  menu and select Restart....

If you decide later you want to re-engage SIP (and I earnestly hope that you do), repeat these steps, use csrutil enable instead.



来源:https://stackoverflow.com/questions/46535279/what-is-library-stagedextensions-for-and-how-to-remove-extensions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!