macOS uses VNC for remote management, and has a built-in server and viewer. (Turn on the server under System Preferences > Sharing and mash the checkbox for Screen Sharing.)
But if you’re here, you probably knew that already, and you want to change the default VNC port from 5900 to something else.
Get out your terminal:
sudo nano /System/Library/LaunchDaemons/com.apple.screensharing.plist
Or use vim. Whatever. It’s your party. Your terminal party.
You’re looking for this line (line 34 in El Capitan, and since Lion):
You want to change the text “vnc-server” to whatever you want your port to be. For example, this would make it port 1337:
Don’t use port 1337.
Then turn Screen Sharing off/on again in preferences, or restart your machine. It should use the new port now.
Connecting to it from a Mac
Use the built-in VNC viewer by going to Finder > Go > Connect to Server… Under “Server Address” enter: