3 ms·
~1 month ago, when setting up my new Macbook it took me forever to debug this. After hours of trying to mess with the builtin Apache service (thinking it was th
by gnrlst 5y ago
~1 month ago, when setting up my new Macbook it took me forever to debug this. After hours of trying to mess with the builtin Apache service (thinking it was the culprit), I found a random blog post that said to disable the sharing feature occupying the port in the system preferences. It was devilishly hard to debug (and google for) at the time.
For those wondering why I needed port 5000 in my case, it was a standard Svelte app serving on localhost:5000 (via Sirv).
- rdbell 5y agoDoesn't something like `lsof -i TCP -s TCP:LISTEN` quickly show what's monopolizing 5000?
- op00to 5y agoYes.
- tokamak-teapot 5y agoDoes lsof show that 5000 is in use? Is Svelte hard-wired to 5000?
- gnrlst 5y agoI didnt try lsof. I figured it was a permissions issue and started going down the Apache rabbit hole since when trying localhost without a port it displayed a page with "it works"... I thought it had monopolized the whole localhost. Svelte is not hard-wired to 5000, but I made it a point to fix it since I didn't like the idea of a random port being blocked.
- op00to 5y agoWalk the OSI model next time instead. :)
- tokamak-teapot 5y agoIt’s interesting that you thought it was a permissions issue, which suggests that Svelte didn’t report that the port was in use - at least not in clear enough language. I started off thinking it was a bit ridiculous that people developing wouldn’t just think ‘oh port 5000 is busy - let me try -p 6000 when running this’ but I see that was a wrong assumption, because the tool itself seems to perhaps be flawed in that it isn’t making it easy to diagnose and change how it runs to sidestep the used port. Perhaps a feature request for svelte is in order?
- simiones 5y agoOthers have suggested `lsof` to find out which ports are in use and by whom. I'll also add `netstat -nlp` or the more modern `ss -ntlp` to achieve the same. They will show you which process is listening on which TCP port (with these flags).
- gnrlst 5y agoWill use next time! thanks for the tip.
- simiones 5y agoNo problem! We all know some limited amount about the huge computing environment, and accumulate solutions as we hit problems.
- phaer 5y agoCan't check myself, because I am not using MacOS, but isn't `ss` linux-specific? I think it still is (and will be) `netstat` on MacOS and BSDs?
- simiones 5y agoDon't use MacOS or any BSD, so you are quite possibly right.