---
title: "SCPreferencesSetLocalHostName(_:_:)"
framework: systemconfiguration
role: symbol
role_heading: Function
path: "systemconfiguration/scpreferencessetlocalhostname(_:_:)"
---

# SCPreferencesSetLocalHostName(_:_:)

Sets the local host name to the specified name.

## Declaration

```swift
func SCPreferencesSetLocalHostName(_ prefs: SCPreferences, _ name: CFString?) -> Bool
```

## Parameters

- `prefs`: The preferences session.
- `name`: The local host name. This string must conform to the naming conventions of a DNS host name as specified in RFC 1034 (section 3.5).

## Return Value

Return Value TRUE if successful; otherwise, FALSE.

## Discussion

Discussion To commit these changes to permanent storage you must call the SCPreferencesCommitChanges(_:) function. In addition, you must call the SCPreferencesApplyChanges(_:) function for the new name to become active.

## See Also

### Setting Configuration Information

- [SCPreferencesSetComputerName(_:_:_:)](systemconfiguration/scpreferencessetcomputername(_:_:_:).md)
