When running a command as sudo in macOS, you can use this command to sudo. The command is running under the logged-in user. You can also choose to run on Swif admin user.
To run as sudo, you can run this command `echo '{PASSWORD}' | sudo -S ls`. The PASSWORD is the local user password.