Ports
What a port is
Section titled “What a port is”When two programs communicate over a network, they use an IP address to identify the machine and a port number to identify the specific service on that machine. A Mac running both a web server and a database server has one IP address but two ports – one for each service.
Think of it like a building: the street address (IP) tells you which building, and the apartment number (port) tells you which unit inside.
Port numbers range from 0 to 65535. Many common services have established default ports that software assumes when no port is specified:
| Service | Default port |
|---|---|
| HTTP (web) | 80 |
| HTTPS (web, encrypted) | 443 |
| MySQL | 3306 |
When you type http://example.com in a browser, the browser silently connects to port 80. No port number appears in the address bar because 80 is the understood default.
Why MAMP does not use port 80
Section titled “Why MAMP does not use port 80”On macOS, ports below 1024 are privileged ports. Only processes running with administrator rights can open them. If MAMP used port 80, macOS would ask for your admin password every time the servers start.
MAMP avoids this by defaulting to port 8888 for the web server and 8889 for MySQL. Both are well above 1024 and can be opened by a normal user process without elevated permissions.
The only visible consequence is that you have to include the port number in local URLs:
http://localhost:8888/my-project/instead of just:
http://localhost/my-project/When to change the ports
Section titled “When to change the ports”You may want to switch to ports 80 and 3306 (the Settings › Ports › “80 & 3306” button) in two situations:
- Your project hardcodes port 80. Some CMS configurations or scripts assume the web server is on the standard port and break when they see
:8888in a URL. - You want URLs without a port number. Some developers prefer
http://localhost/for a cleaner address bar.