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

# CFMessagePortSetName(_:_:)

Sets the name of a local CFMessagePort object.

```
func CFMessagePortSetName(_ ms: CFMessagePort!, _ newName: CFString!) -> Bool
```

## Parameters

`ms`

The local message port to examine.

`newName`

The new name for `ms`.

## Return Value

`true` if the name change succeeds, otherwise `false`.

## Discussion

Other threads and processes can connect to a named message port with [`CFMessagePortCreateRemote(_:_:)`](/documentation/CoreFoundation/CFMessagePortCreateRemote(_:_:)).

---

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)