<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFPreferencesSetAppValue(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFPreferencesSetAppValue"
  },
  "title" : "CFPreferencesSetAppValue(_:_:_:)"
}
-->

# CFPreferencesSetAppValue(_:_:_:)

Adds, modifies, or removes a preference.

```
func CFPreferencesSetAppValue(_ key: CFString, _ value: CFPropertyList?, _ applicationID: CFString)
```

## Parameters

`key`

The preference key whose value you wish to set.

`value`

The value to set for the specified `key` and application. Pass `NULL` to remove the specified key from the application’s preferences.

`applicationID`

The ID of the application whose preferences you wish to create or modify, typically [`kCFPreferencesCurrentApplication`](/documentation/CoreFoundation/kCFPreferencesCurrentApplication). Do not pass `NULL` or [`kCFPreferencesAnyApplication`](/documentation/CoreFoundation/kCFPreferencesAnyApplication). Takes the form of a Java package name, `com.foosoft`.

## Discussion

New preference values are stored in the standard application preference location, `~/Library/Preferences/`. When called with [`kCFPreferencesCurrentApplication`](/documentation/CoreFoundation/kCFPreferencesCurrentApplication), modifications are performed in the preference domain “Current User, Current Application, Any Host.” If you need to create preferences in some other domain, use the low-level function [`CFPreferencesSetValue(_:_:_:_:_:)`](/documentation/CoreFoundation/CFPreferencesSetValue(_:_:_:_:_:)).

You must call the [`CFPreferencesAppSynchronize(_:)`](/documentation/CoreFoundation/CFPreferencesAppSynchronize(_:)) function in order for your changes to be saved to permanent storage.

---

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)