Search code examples
sudoosx-elcapitan

sudo mkdir in /usr/, Operation not permitted. El Capitan


Attempting to install PHP, which requires the creation of an extensions directory within /usr/lib/php/extensions. The installation returned an error "Operation not permitted".

I have since found out, sudo is not able to create any directories under /usr/. Anyone else experienced this?


Solution

  • Local installations really should be installed under /usr/local, not directly under /usr. Starting in El Capitan, this is enforced by System Integrity Protection. Shouldn't be a big change, just install the extensions in /usr/local/lib/php/extensions, and edit php.ini to set extension_dir to the appropriate location.