Articles

PIP Install on Mac: Operation Not Permitted


If you are trying to do a

pip install <package>

on a Mac and get an error like

Could not create /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7: Operation not permitted

You hit an internal protection called System Integrity Protection built-in OS X El Capitan and later that, among other things, protects some paths of your root filesystem in a way that not even the user root can write to them.

And your are not alone, this "issue" has hit a lot of users of different open source Python packages, as one can see in some GitHub Issues.

In the specific case of using PIP to install Python packages, you can overcome this by installing everything into your own home directory with the --user flag, like:

pip install <package> --user

This flag is documented in the "Installing to the User Site" section of the "Python Packaging User Guide", and there is more in depth description of the process in the "User Installs" section of the "PIP User Guide"

For more information on SIP, I recommend you start with this great article about OSX El Capitan System Integrity Protection (or SIP)