<!--
{
  "availability" : [
    "macOS: 10.0.0 - 10.13.0"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSSocketPortNameServer/removePortForName:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSocketPortNameServer(im)removePortForName:"
  },
  "title" : "removePortForName:"
}
-->

# removePortForName:

Unregisters the port for a given name on the local host.

```
- (BOOL) removePortForName:(NSString *) name;
```

## Parameters

`name`

The name of the port to unregister.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if successful, otherwise <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

If the operation is successful, the port can no longer be looked up using the name `portName`. Other applications that already have a reference to the port can continue to use it until it becomes invalid.

---

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)