fakeroot

Simulates root privileges for file operations without actual root access

brewmacoslinux
Try with needOr install directly
Source

About

Provide a fake root environment

Commands

fakerootfakeroot-sysv

Examples

Run a command with fake root privileges$ fakeroot touch /root/testfile
Build a package as non-root user with root-like permissions$ fakeroot dpkg-buildpackage -us -uc
Create tar archive with fake root ownership$ fakeroot tar czf archive.tar.gz --owner=root --group=root /path/to/files