OS error code 48 when trying to start a new process

As I was messing around with different canisters I just got another error when trying to run a new process namely error code 48. Even though I though I had ran dfx stop on every process it still seemed to be running somewhere causing port 8000 to be blocked. To unblock do the following:

First run the command

sudo lsof -i tcp:8000

This will give you a list that looks like this:

COMMAND  PID          USER            FD   TYPE             DEVICE          SIZE/OFF NODE NAME
dfx                3797        dfinitybasics    9u  IPv4 0xb5a2847f730420e9      0t0  TCP localhost:irdmi (LISTEN)

then use the following command:

kill -9 3797

Where the number behind the -9 should be the number below the PID column.


You can also run

killall dfx replica nodemanager

to target them by name. Also see here: Nodemanager can't be killed

Note as of V0.5.1 nodemanager won’t be used by dfx start so you’ll be able to omit it.