MacOS – OS X file permissions prevent me to delete files

macospermissionSecurity

I installed easy_install on mac wityh the following command:

curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python

After that I tried to install pip but couldn't.
After checking here is what I have in /usr/bin

$ ls -l easy*
-rwxr-xr-x  2 root  wheel  925  7 Jan  2016 easy_install
-rwxr-xr-x  1 root  wheel  454  7 Jan  2016 easy_install-2.6
-rwxr-xr-x  1 root  wheel  461  7 Jan  2016 easy_install-2.7

Probably it does not work because I have 2 versions installed now. I am in the list of sudoers but even with sudo I cannot delete these files:

sudo rm -f easy_install-2.6
Password:
rm: easy_install-2.6: Operation not permitted

When I log in to this MacBook there is my username and also Administrator which I do not have access to now.

Is there a way to be able to delete these files without having to wait until the person that has the password for Administrator comes back from vacation?

Here is my MacBook info

  System Version: OS X 10.11.6 (15G31)
  Kernel Version: Darwin 15.6.0
  Boot Volume: Macintosh HD

Best Answer

That easy_install came with the system, it's not the one you tried to install. The files coming with macOS are protected by system integrity protection.

On my machine this looks like:

$ ls -lO /usr/bin/easy*
-rwxr-xr-x  2 root  wheel  restricted,compressed 925 31 Jul 04:27 /usr/bin/easy_install
-rwxr-xr-x  1 root  wheel  restricted,compressed 454 31 Jul 04:27 /usr/bin/easy_install-2.6
-rwxr-xr-x  1 root  wheel  restricted,compressed 458 31 Jul 04:27 /usr/bin/easy_install-2.7

"restricted" means "protected by SIP"

If you want to use PIP on the mac, create a virtualenv in your home directory and do everything there, then you'll be independent from the system libraries.