# Uninstalling DNClient

Uninstall DNClient the same way you [installed](/docs/get-started/install/) it. Find your platform and the method you used below. To also remove the host from your network, [delete it](/docs/guides/managing-hosts/#delete-a-host) in the admin panel.

**Tab: macOS**

## macOS

### DNClient Desktop \{#macos-desktop\}

#### Homebrew \{#macos-desktop-homebrew\}

```sh
brew uninstall --cask dnclient
```

To also delete its settings and enrollment state in `/Library/Application Support/DefinedNet`, along with its caches and preferences, use `--zap`:

```sh
brew uninstall --zap --cask dnclient
```

#### Download \{#macos-desktop-download\}

Delete DNClient Desktop from the Applications folder. Its background process keeps running until you restart the computer, or until you turn it off under "Login Items & Extensions" in System Settings.

### DNClient Server \{#macos-server\}

If you installed any [named instances](/docs/guides/migrating-between-networks/), stop and uninstall each one first, passing its name:

```sh
sudo dnclient stop -name <name>
sudo dnclient uninstall -name <name>
```

#### Homebrew \{#macos-homebrew\}

Stop and remove the service before uninstalling the cask:

```sh
sudo dnclient stop
sudo dnclient uninstall
brew uninstall --cask dnclient-server
```

To also delete its enrollment state in `/etc/defined`, use `brew uninstall --zap --cask dnclient-server` instead.

#### Standalone binary \{#macos-binary\}

```bash
sudo dnclient stop
sudo dnclient uninstall
rm $(which dnclient)
# To remove config / log files:
sudo rm /etc/defined/config.yml /etc/defined/dnclient.yml
sudo rm -r /etc/defined/
sudo rm /usr/local/var/log/dnclient.*.log
```

**Tab: Windows**

## Windows

Uninstalling DNClient on Windows removes its installation directory, which holds the configuration for every enrolled network.

### DNClient Desktop \{#windows-desktop\}

Use any of these:

- With winget, run `winget uninstall DefinedNet.DNClient.Desktop`.
- In "Add or remove programs", find "DNClient Desktop" (named "Defined Networking Client" in older versions) and uninstall it.
- Open the `DNClient-Desktop.msi` you installed from, choose "Next", then "Remove". A newer MSI offers to upgrade instead.

### DNClient Server \{#windows-server\}

If you installed any [named instances](/docs/guides/migrating-between-networks/), stop and uninstall each one first, passing its name, in a PowerShell terminal started as Administrator:

```powershell
& 'C:\Program Files\Defined Networking\DNClient\dnclient.exe' stop -name <name>
& 'C:\Program Files\Defined Networking\DNClient\dnclient.exe' uninstall -name <name>
```

Use any of these:

- With winget, run `winget uninstall DefinedNet.DNClient.Server`.
- In "Add or remove programs", find "DNClient Server" (named "Defined Networking Client" in older versions) and uninstall it.
- Open the `DNClient-Server.msi` you installed from, choose "Next", then "Remove". A newer MSI offers to upgrade instead.

**Tab: Linux**

## Linux

### Package installations

Remove `dnclient` with your package manager. On APT and RPM, removing the package stops the service.

If you enabled any named instances, disable each one first so its systemd symlinks don't outlive the package:

```bash
sudo systemctl disable --now dnclient@<name>
```

**Tab: APT**

```bash
# Remove the package, keeping enrollment state in /var/lib/defined
sudo apt-get remove dnclient
# Or purge, which also deletes /var/lib/defined and /etc/default/dnclient
sudo apt-get purge dnclient
```

Any [environment file](/docs/get-started/install/#service-configuration) you created for a named instance belongs to you rather than the package, so even a purge leaves it behind:

```bash
sudo rm -f /etc/default/dnclient.<name>
```

To stop receiving updates, also remove the repository definition:

```bash
sudo rm /etc/apt/sources.list.d/defined-net.list /etc/apt/keyrings/defined-net.asc
```

**Tab: RPM**

```bash
sudo dnf remove dnclient
# Removal leaves enrollment state behind; delete it if you're done with the host
sudo rm -r /var/lib/defined
```

If you edited `/etc/sysconfig/dnclient`, `rpm` preserves your copy as `/etc/sysconfig/dnclient.rpmsave`. Any [environment file](/docs/get-started/install/#service-configuration) you created for a named instance isn't owned by the package and is left in place:

```bash
sudo rm -f /etc/sysconfig/dnclient.rpmsave /etc/sysconfig/dnclient.<name>
```

To stop receiving updates, also remove the repository definition:

```bash
sudo rm /etc/yum.repos.d/defined-net.repo
```

**Tab: Arch (AUR)**

```bash
# pacman doesn't stop services on removal, so disable it first
sudo systemctl disable --now dnclient
# -n deletes /etc/conf.d/dnclient rather than keeping it as a .pacsave file
sudo pacman -Rns dnclient
# Removal leaves enrollment state behind; delete it if you're done with the host
sudo rm -r /var/lib/defined
```

Any [environment file](/docs/get-started/install/#service-configuration) you created for a named instance isn't tracked by `pacman`:

```bash
sudo rm -f /etc/conf.d/dnclient.<name>
```

### Standalone binary installations

```bash
sudo dnclient stop
sudo dnclient uninstall
rm $(which dnclient)
# To remove state files:
sudo rm -r /var/lib/defined/
# service managers like systemd will auto-delete logs
```

:::note

DNClient 0.9.4 moved the Linux state directory from `/etc/defined` to `/var/lib/defined`. A host that enrolled before 0.9.4 and upgraded in place keeps using `/etc/defined`, because DNClient falls back to the old directory when the new one holds no enrolled networks. This applies to package installations too, if the host first enrolled under an older standalone binary. Check both locations, and remove `/etc/defined/` too if it's still there.

:::

**Tab: Docker**

## Docker

Remove the container. To also delete the host's enrollment state, remove the `defined` volume, and to free the disk space, remove the image:

```sh
docker rm -f dnclient
docker volume rm defined
docker image rm definednet/dnclient
```

**Tab: iOS and Android**

## iOS and Android

Delete Mobile Nebula like any other app. Apple's [Delete apps on your iPhone or iPad](https://support.apple.com/101550) and Google's [Delete, disable & manage unused apps on Android](https://support.google.com/android/answer/2521768) cover the steps. Deleting the app doesn't remove the device from your network, so also [delete its host](/docs/guides/managing-hosts/#delete-a-host) in the admin panel.
