Libp11 build from source permissions


I am trying to install libp11 from master:
brew install --HEAD libp11
and I get errors like:
libtool: install: /usr/bin/install -c .libs/pkcs11.dylib
install: /usr/local/Cellar/openssl/1.0.2s/lib/engines/pkcs11.dylib: Operation not permitted

If I run the same command manually from shell, it works without a problems.

I’ve tried running with debug mode on and open a shell, but the result was the same: I am unable to copy/install the file through homebrew shell, while in normal shell (iterm2/zsh) it works without any problems.

So, what can be blocking Homebrew from being able to install the file, while regular shell has. I guess this is something internally in homebrew or OSX security features but I am unable to track that down.

latest brew, doctor says everything is ok, …

thanks in advance

What if you try it with bash in your normal shell? And what are the permissions for the target directory?

If I try in normal shell, bash or zsh, it works without a problem. If I run the command from build directory, it works without a problem.
The problem occurs only when is executed with brew or shell in brew.

Target directory is 0755 and owned by my account.

The issue was in homebrews sandboxing. When you build from source, homebrew sandboxes the build procedure to prevent writing files out of ${Cellar}/package/ directory.

HEAD build of libp11 introduced new file outside of ${Cellar}/package/ and therefor failed when make install was called.
The solution was to update libp11 build procedure and fix location of new file.

I packaged it in tap: