This is what happened to me during my first ever attempt to run python flask server on my Macbook.
Python Flask default port number is set to 5000.
As I started running the server on the terminal, it prompted an error message saying OSError: [Errno 48] Address already in use
.
Don't worry and just follow this step-by-step guide if this happens to you.
- using Cmd + space, search Network Utility.app and open it
- on the app, you will see port scan menu.
- type your localhost ip address ex) 127.0.0.1 and click scan button
- if you see the 5000 port number, yeah that's what it is
- on terminal, run
lsof -i tcp:5000
- now you will see PID(Process ID) number then, copy it.
- on terminal, run
kill -9 <PID>
Once you complete it, you can try to run the flask server again.