Easily request superuser privilege in macOS applications with a user-interactive and native password prompt.
Privilege only supports Swift Package Manager. Add it as a dependency in your project's Package.swift
dependencies section as follows:
.package(name: "Privilege", url: "https://github.com/mayankk2308/privilege.git", from: "1.0.0")
Then add the package "Privilege"
to your targets that require it.
First import the module:
import Privilege
To gain superuser permissions:
Privilege.escalate()
// Returns true if rights are extended successfully.
To de-escalate:
Privilege.deEscalate()
// Returns true if rights are dropped successfully.