How to remove Apple Git in macOS Sierra located in / usr / bin / git ?

This is the native Git macOS git version 2.8.4 (Apple Git-73)

I have already attempted to rename the /usr/bin/git with the sudo mv /usr/bin/git /usr/bin/git-apple , but it did not work and I received a response

mv: rename / usr / bin / git to / usr / bin / git-apple: Operation not permitted

Any other ideas on how to remove Apple Git?

  • one
    And why remove the system? You can put your own, separately in a folder and add the path with it to PATH. If this does not fit, there are more cardinal and correct approaches. - KoVadim
  • one
  • Updated the answer there. - Nick Volynkin
  • I do not need a system one. In fact of the matter. I can put another Git, but why do I need a system one that takes up space? - user223376
  • Operation not permitted - perhaps, an analogue of chattr , the program chflags , is used here. An example of use for this purpose is here: cyberciti.biz/faq/… - aleksandr barakin

1 answer 1

Operation not permitted

perhaps, an analogue of chattr , the chflags program, is used here.

An example of using it for this purpose (to protect the file from being modified) is here .


view flags:

 $ ls -lO /путь/к/файлу 

make the file "system-immutable" ( system immutable ):

 $ sudo chflags schg /путь/к/файлу 

reverse action:

 $ sudo chflags noschg /путь/к/файлу 

make the file "user-immutable" ( user immutable ):

 $ chflags uchg /путь/к/файлу 

reverse action:

 $ chflags nouchg /путь/к/файлу 
  • @NickVolynkin, why? - well, for example, to "protect the user from rash actions ." By the way, not only a single file can be protected, but the entire directory ( /usr/bin , with reference to this issue). - aleksandr barakin
  • Well, yes, and the iPhone is also waterproof, so that it was convenient to drop it from the back pocket into the toilet. Everything is logical. :) - Nick Volynkin
  • @NickVolynkin, please unsubscribe if you managed to remove Apple Git using this method. - user223376
  • I tried the suggested commands, but the permissions were as before - user223376
  • -rwxr-xr-x 1 root wheel restricted, compressed remained the same - user223376