About deleting files that have restricted flag to completion of Xcode.

My questions: 


  1. Will deleting files, which have restricted flags and are mentioned to delete for Xcode uninstall here and there, cause defects on systems?

  2. What is the best way of deleting them to make a minimum of effect on systems?




Details:


Question1

I tried to uninstall Xcode from my system by referring to ref1, and I am struggling at the last step. According to the instruction, what I need to do for the completion is deleting the two files below (Other files that need to be deleted to uninstall Xcode have gone). 
  • /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist

  • /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom



However, they had a restricted flag, which any users even root are NOT allowed to modify strictly. Will deleting them cause severe effects on my system?

Code Block
(base) macbook-pro-3:~ MYNAME$ ls -lO /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
-rw-r--r-- 1 root wheel restricted 396 May 10 2018 /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
(base) macbook-pro-3:~ MYNAME$ ls -lO /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
-rw-r--r-- 1 root wheel restricted 53626 May 10 2018 /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom

Question2

If not, what is the best way to delete them to keep the system safe?  I have already tried two resolutions 1 and 2, which are shown below, but none of them worked for my system.

resolution 1 :

Code Block
sudo /Developer/Library/uninstall-devtools --mode=all
sudo: /Developer/Library/uninstall-devtools: command not found 

It didn't work because of warming "command not found.".

resolution 2:


Code Block
(base) macbook-pro-3:~ MYNAME$ sudo rm /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
override rw-r--r-- root/wheel restricted for /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist? y
rm: /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist: Operation not permitted
(base) macbook-pro-3:~ MYNAME$ sudo rm /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
override rw-r--r-- root/wheel restricted for /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom? y
rm: /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom: Operation not permitted 

It didn't work because of warming "Operation not permitted.".

resolution 3 :


I found that disabling SIP works for some systems to delete such files (ref2). However, I think it might be too risky because I have meager experience in SYSTEM engineering. 
I would appreciate your support in advance.


References
  • ref1: https: // hdzone.com/articles/how-to-completely-uninstall-xcode-from-mac

  • ref2: https: // discussions.apple.com/thread/251137748

Note: There are some extra spaces before and after the double slashes due to editing restrictions. May I trouble you to delete them to refer to the page?


About my system
  • OS: Catalina version 10.15.7

  • Processor: 2.6GHz Dual-Core

  • Xcode: version 11.x (I carelessly started to uninstall them without checking the version. However, I wonder if it could be version 11.)

Hello @minako_375 Did You manage to resolve your problem? I have the same issue and couldn't find any solution.

Best regards,

About deleting files that have restricted flag to completion of Xcode.
 
 
Q