Sandboxie or an alternative to macOS [closed]

The only true equivalent of Sandboxie on MacOS is using a VM.

The built-in App Sandbox can restrict access to sensitive resources on a per-app basis

You may also use Time Machine to return the computer to its state before you installed or used a new application.

You may use AppCleaner to clean up after an installed app, but it cannot undo modifications done by that application.