Error when installing PHP SDK on macOS

These are the privileges of the directory /usr/lib/php
Magnifico:~ leonardop$ cd /usr/lib/php
Magnifico:php leonardop$ ls -la
total 0
drwxr-xr-x 4 root wheel 128 Feb 8 2018 .
drwxr-xr-x 312 root wheel 9984 Dec 23 18:05 …
drwxr-xr-x 14 root wheel 448 Nov 3 10:25 build
drwxr-xr-x 3 root wheel 96 Feb 8 2018 extensions
Magnifico:php leonardop$

And I didn’t change these permissions. That’s the default on macOS.
The Couchbase engineers should know that.

I tried to run
sudo brew install libcouchbase
and I got this error message
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

So I did
Magnifico:~ leonardop$ brew reinstall libcouchbase
==> Reinstalling libcouchbase
==> Downloading https://homebrew.bintray.com/bottles/libcouchbase-2.10.3.high_sierra.bottle.tar.gz
Already downloaded: /Users/leonardop/Library/Caches/Homebrew/downloads/31fa86db7a0380371603961259687e8b042a7acf31d5f0c08707e9bb41013a3c–libcouchbase-2.10.3.high_sierra.bottle.tar.gz
==> Pouring libcouchbase-2.10.3.high_sierra.bottle.tar.gz
:beer: /usr/local/Cellar/libcouchbase/2.10.3: 117 files, 3.3MB
Magnifico:~ leonardop$

Nothing changed. Same troubles as before.