Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: failed to write, failed to open stream, pecl install oauth on mac osx el capitan

I'm trying to install OAuth version 1.2.3 locally with pecl install (running PHP 5.6.10 on Mac OSX El Capitan). Running the following in command prompt:

sudo pecl install oauth-1.2.3

Installation starts fine and runs without errors up until build is done. Then I get this error:

Build process completed successfully
Installing '/usr/lib/php/extensions/no-debug-non-zts-20121212/oauth.so'
ERROR: failed to write /usr/lib/php/extensions/no-debug-non-zts-`20121212/oauth.so 
(copy(/usr/lib/php/extensions/no-debug-non-zts-20121212/oauth.so): 
failed to open stream: Operation not permitted)`

ls shows no oauth.so in folder no-debug-non-zts-20121212, but other than that, folder looks fine.

Things I've tried: - updating pear and pecl - updating MAMP - restarting webserver - restarting computer

Am running out of ideas of things to try. Anyone who's heard of this issue before?

like image 774
M Brus Avatar asked Jan 18 '16 09:01

M Brus


1 Answers

You need to disable the System Integrity Protection.

  1. Reboot the Mac and hold down Command + R keys simultaneously after you hear the startup chime, this will boot OS X into Recovery Mode.
  2. When the "OS X Utilities" screen appears, pull down the "Utilities" menu at the top of the screen, and choose "Terminal".
  3. Type the following command into the terminal then hit return: csrutil disable

  4. You’ll see a message saying that System Integrity Protection has been disabled and the Mac needs to restart for changes to take effect.

  5. Enter the reboot command, and the Mac will then reboot itself automatically, just let it boot up as normal.

Then try again with sudo pecl install oauth-1.2.3. After the oauth.so is correctly installed in /usr/lib/php/extensions/no-debug-non-zts-20121212/ you should enable the SIP again (after all, this is a feature to protect our system, so it's better to keep it ON).

References consulted:

  • Install mcrypt for php on Mac OSX 10.11 El Capitan for a Development Server.
  • How to Disable System Integrity Protection (rootless) in OS X El Capitan.
like image 160
Simón Sánchez Avatar answered Nov 04 '22 11:11

Simón Sánchez