networksetup Command NOT Allowing Setting Computer Name > 31 Characters

Number:rdar://26253116 Date Originated:May 12, 1016
Status:Open Resolved:
Product:OS X Product Version:10.11.4
Classification: Reproducible:Always
The maximum length of the host name and of the fully qualified domain name (FQDN) is 63 bytes per label and 255 bytes per FQDN. Note - Windows does not permit computer names that exceed 15 characters, and you cannot specify a DNS host name that differs from the NETBIOS host name.

DNS limits the length of each label in RFC 1035 - however, that limit is actually 63. Both in RFC 1035 section 2.3.1 and as clarified in RFC 2181 section 11.
On OS X 10.11.4, running networksetup, version 1.8.2. It will NOT allow you to set computer hostname to more than 31 characters.

For example, this "networksetup" command can NOT set the Computer Name to 32 characters
networksetup -setcomputername 01234567890123456789012345678901
01234567890123456789012345678901 is NOT a valid computer name.
** Error: The parameters were not valid.

But, a length of 31 characters or less will not generate the error and the computer name will be set properly.

networksetup -setcomputername 0123456789012345678901234567890

This name is used by Apple Filing Protocol (AFP). AFP originally had a 31 character file limit so this could be the reason that you are unable to surpass the 31 character value, but might not be necessary anymore and could be removed.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!