<!--
{
  "availability" : [
    "macOS: 10.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SystemConfiguration",
  "identifier" : "/documentation/SystemConfiguration/SCPreferencesLock(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "System Configuration"
    ],
    "preciseIdentifier" : "c:@F@SCPreferencesLock"
  },
  "title" : "SCPreferencesLock(_:_:)"
}
-->

# SCPreferencesLock(_:_:)

Locks access to the configuration preferences.

```
func SCPreferencesLock(_ prefs: SCPreferences, _ wait: Bool) -> Bool
```

## Parameters

`prefs`

The preferences session.

`wait`

A Boolean value indicating whether the calling process should block, waiting for another process to complete its update operation and release its lock.

## Return Value

`TRUE` if the lock was obtained; `FALSE` if an error occurred.

## Discussion

This function obtains exclusive access to the configuration preferences. Clients attempting to obtain exclusive access to the preferences either receive a [`kSCStatusPrefsBusy`](/documentation/SystemConfiguration/kSCStatusPrefsBusy) error or they block, waiting for the lock to be released.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)