FullDiskAccess is a Swift package for querying and prompting for Full Disk Access permission on macOS 10.14+
When your macOS app is not sandboxed and you need to access system files or files belonging to other apps. Example apps: file backup apps, apps that need to search the entire system, etc.
The lack of documentation regarding Full Disk Access creates a lot of confusion online, so I ran 6 VMs to confirm behavior between macOS versions. This package makes clear what's possible and what's not, and makes it easy to check permission and prompt the user.
import FullDiskAccess
if FullDiskAccess.isGranted {
// Great!
}
ℹ️ On macOS 10.15+, checking isGranted
will automatically add your app to the Full Disk Access entries in Privacy & Security (unchecked)
Apps cannot enable Full Disk Access automatically (for good reason), so the user will have to do that. We make it easy by automatically adding the app to the Full Disk Access entries in Privacy & Security (unchecked) and guiding the user to that screen.
import FullDiskAccess
FullDiskAccess.promptIfNotGranted(
title: "Enable Full Disk Access for MacSymbolicator",
message: "MacSymbolicator requires Full Disk Access to search for DSYMs using Spotlight.",
settingsButtonTitle: "Open Settings",
skipButtonTitle: "Later",
canBeSuppressed: false, // `true` will display a "Do not ask again." checkbox and honor it
icon: nil
)
![](https://private-user-images.githubusercontent.com/679224/311560409-236b719d-2b4a-4f03-8aef-ba1d11e176c4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk0MzgwOTksIm5iZiI6MTcxOTQzNzc5OSwicGF0aCI6Ii82NzkyMjQvMzExNTYwNDA5LTIzNmI3MTlkLTJiNGEtNGYwMy04YWVmLWJhMWQxMWUxNzZjNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyNlQyMTM2MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MjAzYWU5MzA4OWRhZmU1NWU3ODA5ZWZlNWJmMzNlYTY3NGI2ODMxN2I5MzFkZTI2ZmZjMjNjYTk1ZmRhN2ZlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.taGBBTSIZuPY6L3s4aSXTF7vqViwdsaWWrS5tyVFSUM)
![](https://private-user-images.githubusercontent.com/679224/311482200-d52dab09-2974-45bd-807a-dc3f8edb8f55.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk0MzgwOTksIm5iZiI6MTcxOTQzNzc5OSwicGF0aCI6Ii82NzkyMjQvMzExNDgyMjAwLWQ1MmRhYjA5LTI5NzQtNDViZC04MDdhLWRjM2Y4ZWRiOGY1NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjI2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyNlQyMTM2MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zNWU4M2RmNTU1ZjAwZjk3ZGZlZjA1M2FiMTc1OWU4ODY4MzdhYjQyZGM1YmMxZWJjMDg5ODYyYTk5NDA2ZmI4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.xreGLjIiRYEt7XnvJVJyAA-CygEbtm76puPMAbPQPdA)
import FullDiskAccess
// Opens the System Settings (aka System Preferences) with the Privacy & Security preference pane open and the
// Full Disk Access tab pre-selected.
FullDiskAccess.openSystemSettings()
// Resets the prompt suppression (i.e. if the user has selected "Do not ask again.", this resets their choice)
FullDiskAccess.resetPromptSuppression() {
Believe something is not right or have a suggestion for improvements? Your feedback is welcome. Please create an issue!