A Swift framework for managing privileged helpers on macOS, providing a comprehensive set of APIs for installation, management, and communication with privileged helpers.
- Easy-to-use API interface
- Support for privileged helper installation and uninstallation
- Version checking and updates
- Secure XPC-based communication
- Support for both legacy and modern installation methods
- Complete error handling and logging
- Type-safe API design
- macOS 10.15 +
- Swift 5.10 +
- Xcode 15.4 +
Add the following dependency to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/codingiran/PrivilegedHelperKit.git", from: "0.0.8")
]
let manager = PrivilegedHelperManager(
machServiceName: "com.example.helper",
mainAppBundleIdentifier: "com.example.app"
)
manager.delegate = self
let status = await manager.getHelperStatus()
switch status {
case .installed:
print("Helper is installed")
case .notFound:
print("Helper not found")
case .needUpdate(let supportUnInstall):
print("Helper needs update")
case .requiresApproval:
print("Helper requires approval")
}
let isInstalled = await manager.checkHelperInstall()
if isInstalled {
print("Helper installed successfully")
}
let proxy = try await manager.getPrivilegedHelperProxy()
let version = try await manager.getHelperVersion()
- Manages the lifecycle of the privileged helper
- Handles installation, updates, and communication
- Provides version checking and status monitoring
- Manages XPC connections securely
- Implements the helper process functionality
- Manages XPC listener and connections
- Handles helper termination and cleanup
- Provides uninstallation capabilities
- Proper code signing and authorization requirements must be configured
- User authorization is required for installation
- Review Apple's security guidelines before implementation
- Ensure proper entitlements are configured
- Always check helper status before operations
- Handle installation errors appropriately
- Implement proper logging for debugging
- Follow Apple's security guidelines
- Maintain version compatibility
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit issues and pull requests.
Free free to use and modify.