# Can't stop dfx, "No local network replica found. Nothing to do." but is still running

**URL:** <https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289>\
**Category:** Command Line Tools\
**Created:** [November 2, 2021, 7:32pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289 "2021-11-02T19:32:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![cnr](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/cnr/32/4039_2.png) [@cnr](https://forum.dfinity.org/u/cnr)\
**Post date:** [November 2, 2021, 7:32pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/1 "2021-11-02T19:32:26Z")

</div>

`dfx stop` says “No local network replica found. Nothing to do.” but `dfx canister status --all` lists running containers and `dfx deploy` works…

Can’t stop the local network. Any hints to stop it?

---

<div class="post-metadata">

**Author:** ![simpson](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/simpson/32/10431_2.png) [@simpson](https://forum.dfinity.org/u/simpson)\
**Post date:** [November 3, 2021, 4:18am UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/2 "2021-11-03T04:18:06Z")

</div>

First you have to determine whether the path where you run the dfx stop command has the project’s dfx.json file. If not please go to the directory where the dfx.json file is located and execute the stop command.  
If you are already in the working directory, then you can try to query the background process pid by lsof -i:8000 to find the pid of the process and then use kill -9 pid to end the process

---

<div class="post-metadata">

**Author:** ![3cL1p5e7](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/3cl1p5e7/32/4649_2.png) [@3cL1p5e7](https://forum.dfinity.org/u/3cL1p5e7)\
**Post date:** [November 3, 2021, 8:51am UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/3 "2021-11-03T08:51:00Z")

</div>

`kill -9 *ID*` will not help, because process automatically restarts by `ics-proxy`. Uninstall dfx → kill process → install dfx will helps (or OS restart).

---

<div class="post-metadata">

**Author:** ![cnr](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/cnr/32/4039_2.png) [@cnr](https://forum.dfinity.org/u/cnr)\
**Post date:** [November 3, 2021, 3:48pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/4 "2021-11-03T15:48:30Z")

</div>

Yeah had to OS restart. Kinda freaked me out is this an open bug that the team is tracking or did I do something wrong?

I’m 100% sure I was in the same directory as the `dfx.json` file when executing `dfx stop`. Just looked at my terminal history to confirm.

`lsof -i:8000` is a good idea to find the proc, my method was harder. I did find that the network was pretty persistent. Couldn’t manage to kill it off.

---

<div class="post-metadata">

**Author:** ![3cL1p5e7](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/3cl1p5e7/32/4649_2.png) [@3cL1p5e7](https://forum.dfinity.org/u/3cL1p5e7)\
**Post date:** [November 3, 2021, 4:11pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/5 "2021-11-03T16:11:27Z")

</div>

Unfortunately, I don’t know if the Dfinity team knows about this bug or not.

This bug can be caught by performing `dfx start --background` twice without stopping (maybe in separated terminal sessions)

About fix: I can suggest the following:

- you can open PR with fix in [SDK Repo](https://github.com/dfinity/sdk)
- or you can find corresponding github issue and add additional information
- or you can create github issue with a detailed report and steps to reproduce
- after that it is necessary to notify someone from Dfinity team (or wait for an answer on the github)

If you are blocked by this bug, you can temporarily use this solution

- uninstall `~/.cache/dfinity/uninstall.sh`
- find process `lsof -i:8000`
- kill process `kill -9 *pid*`
- install again `sh -ci "$(curl -fsSL https://smartcontracts.org/install.sh)"`

---

<div class="post-metadata">

**Author:** ![mymikemiller](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mymikemiller/32/694_2.png) [@mymikemiller](https://forum.dfinity.org/u/mymikemiller)\
**Post date:** [March 18, 2022, 10:06pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/6 "2022-03-18T22:06:55Z")

</div>

It seems like I have to stop the replica from the same terminal window where I started it. If I try to stop from any other terminal, it tells me that there is no local network replica found, and that there is nothing to do. Other tabs in the original terminal window (on MacOS terminal, anyway) are able to stop it, but not from another terminal window, or VSCode’s built-in terminal (unless dfx was started from there)

 ![Screen Shot 2022-03-18 at 3.51.15 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/f/f987eef0b3c9c6a9be8f86045d2a1a97d827b744.png)

But if I go back to the terminal where I started dfx (or another tab from the same window), I’m able to stop it. After it is stopped, I (correctly, now) get the same message telling me it’s not running.

![Screen Shot 2022-03-18 at 3.53.28 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/0/0701f7d396e79cab46441f9c2ced4aa2daf071f6.png)

Instead of having to keep track of which terminal I started dfx in, it would be nice if there was a way to stop dfx from any terminal, given that it’s a globally running process and I cannot start a second instance in any terminal:

 ![Screen Shot 2022-03-18 at 4.05.10 PM](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/b/be00ad9c757bd5d1c1559c68b9fe45327a95e202.png)

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [October 5, 2022, 8:39pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/7 "2022-10-05T20:39:54Z")

</div>

Does anyone have a `dfx killall` macro that does not rely on uninstalling and then reinstalling dfx?

@Vivienne are there plans for a `dfx killall` or stop command from any terminal with the new global dfx?

Sometimes I’d like to easily stop my dfx server, but I have 10 projects running with different terminal different windows and I have no idea which one is running the DFX server.

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [October 6, 2022, 6:35am UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/8 "2022-10-06T06:35:14Z")

</div>

No plans for now, but I added it as a feature request [here](https://github.com/dfinity/sdk/discussions/2660).

We usually use `killall dfx replica`, but I haven’t had to use it in quite a while so I’m not sure how well it works with the global dfx.

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [May 10, 2023, 9:31pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/9 "2023-05-10T21:31:04Z")

</div>

Bump 🙂 20 characters

---

<div class="post-metadata">

**Author:** ![augchan42](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/augchan42/32/3405_2.png) [@augchan42](https://forum.dfinity.org/u/augchan42)\
**Post date:** [January 2, 2024, 4:37am UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/10 "2024-01-02T04:37:57Z")

</div>

Just ran into this again.

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [July 8, 2024, 5:58pm UTC](https://forum.dfinity.org/t/cant-stop-dfx-no-local-network-replica-found-nothing-to-do-but-is-still-running/8289/11 "2024-07-08T17:58:22Z")

</div>

Just saw this in the [dfx 0.21.0 Release Notes](https://github.com/dfinity/sdk/blob/master/CHANGELOG.md#0210)

![Screenshot 2024-07-08 at 10.57.18](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/f/f/ff08349db516828a0d7ed156e94720e07c5e5b96.png)
