~cs50/pset6/server public and ./server public in my own directory worked fine for a long time but now when I try to run it I get the message "Port 8080 already in use, stopping server."

How can I close port 8080?


2 Answers 2


As far as i can tell you can either use another port than 8080 or better stop the server using that port. The command for the latter is:

apache50 stop

This is somehow not written in the pset6 documentation, but in this video you can find the details by David: https://youtu.be/3dmp0ycKC5c

Hope that helps.


that means that some other process is already using the port (likely to be another instance of your server). terminating/killing that process should make the port available to use.

if this process is not another instance of your server, you probably should not do that and use some other port which is available. the command to kill a process using port 8080 from the command line is

sudo kill `sudo lsof -t -i:8080`


sudo kill $(sudo lsof -t -i:8080)
  • Thanks for the reply - it didn't work, but a friend told me touse !ps to find the process ID, and I was able to to kill it with kill <pid>
    – tomato
    Nov 29, 2015 at 12:46
  • In case anyone else runs into this, this one worked for me. Nov 21, 2016 at 12:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .