Here's my problem:

sudo php -d detect_unicode=0 go-pear.phar

...should let me run as root and modify /usr & /usr/share directories, but I get this:

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : /usr
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/bin
 5. PHP code directory ($php_dir)                 : /usr/share/pear
 6. Documentation directory                       : /usr/docs
 7. Data directory                                : /usr/data
 8. User-modifiable configuration files directory : /usr/cfg
 9. Public Web Files directory                    : /usr/www
10. System manual pages directory                 : /usr/man
11. Tests directory                               : /usr/tests
12. Name of configuration file                    : /private/etc/pear.conf

1-12, 'all' or Enter to continue: 
Unable to create PHP code directory ($php_dir) /usr/share/pear.
Run this script as root or pick another location.

Why is sudo failing to give me root privilege? *Note: *I am in the wheel group, though that should not have anything with this funny sudo behaviour.

Gabbar-Singh:~ anadi$ id anadi
uid=XXX(anadi) gid=XX(staff) groups=XX(staff),0(wheel)

You are trying to install in /usr which is protected by SIP (System Integrity Protection), a feature introduced with 10.11 (see What is the "rootless" feature in El Capitan, really? for details).

Use /usr/local instead, which is the location intended for user-side installations.

  • yeah except I need to link to /usr/include or I can't compile with gcc 4.9! – Michael Aug 5 '17 at 7:00
  • You’ll have to disable SIP then I guess. – jasonology Aug 15 '17 at 1:26
  • Old response, but why can't you just tell GCC where to find the include files? That's what the '-l' option is for. PHP as root... <shudder> – Marc Wilson Dec 15 '18 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .