# supervisor.sock: no such file

> Why supervisorctl prints unix:///tmp/supervisor.sock no such file or refused connection, and the fix: start supervisord, match the config, move the socket.

Source: https://getvisor.dev/guides/supervisor-sock-no-such-file/
Author: Touhidur Rahman (https://touhidurabir.github.io/)

`supervisorctl` prints this when it can’t reach supervisord at all:

```text
unix:///tmp/supervisor.sock no such file
```

The address is the `serverurl` that supervisorctl read from its config, so yours may name another socket. `no such file` means there’s no socket at that path. Your programs may be fine; supervisorctl just can’t ask. There are three usual causes, in this order:

1. supervisord isn’t running.
2. supervisorctl reads a different config than supervisord, so it looks for the socket in the wrong place.
3. Something deleted the socket while supervisord kept running.

## Is supervisord running?

```sh
ps aux | grep '[s]upervisord'
```

No output means it isn’t. Start it the way it was installed:

Starting supervisord:

| Installed with | Command |
| --- | --- |
| Homebrew (macOS) | `brew services start supervisor` |
| Ubuntu or Debian package | `sudo systemctl enable --now supervisor` |
| Fedora package | `sudo systemctl enable --now supervisord` |
| Your own config | `supervisord -c /path/to/supervisord.conf` |

If it doesn’t stay up, run it in the foreground, where it prints why it stopped:

```sh
supervisord -n -c /path/to/supervisord.conf
```

For a Linux service, `systemctl status supervisor` and `journalctl -u supervisor` show the same (`supervisord` on Fedora).

## Do both read the same config?

If `ps` shows supervisord running, look at its command line. A `-c` in it names the config it was started with. supervisorctl, run without `-c`, takes the first config it finds in this order:

1. `etc/supervisord.conf` and `supervisord.conf` beside the folder supervisorctl is installed in, such as `/opt/homebrew/etc/supervisord.conf` for Homebrew;
2. `supervisord.conf` and `etc/supervisord.conf` in the folder you run it from;
3. `/etc/supervisord.conf`, then `/etc/supervisor/supervisord.conf`.

So a `supervisord.conf` in your project folder wins over the system one, and a supervisorctl installed with `pip`, in a virtualenv for example, can find a different file than the one supervisord uses. A `/tmp/supervisor.sock` in the message usually means it found a config made from supervisord’s sample file, which puts the socket in `/tmp`. Homebrew and the Linux packages don’t.

In the config supervisord uses, two lines must name the same socket:

```ini
[unix_http_server]
file=/opt/homebrew/var/run/supervisor.sock

[supervisorctl]
serverurl=unix:///opt/homebrew/var/run/supervisor.sock
```

Point supervisorctl at that config, or straight at the socket:

```sh
supervisorctl -c /opt/homebrew/etc/supervisord.conf status
supervisorctl -s unix:///opt/homebrew/var/run/supervisor.sock status
```

Where the usual installs keep them:

Where supervisord’s config and socket are:

| Installed with | Config | Socket |
| --- | --- | --- |
| Homebrew (macOS) | `$(brew --prefix)/etc/supervisord.conf` | `$(brew --prefix)/var/run/supervisor.sock` |
| Ubuntu or Debian package | `/etc/supervisor/supervisord.conf` | `/var/run/supervisor.sock` |
| Fedora package | `/etc/supervisord.conf` | The `file=` line under `[unix_http_server]` |

`brew --prefix` is `/opt/homebrew` on Apple Silicon and `/usr/local` on Intel.

## The socket was deleted

supervisord’s sample config warns that some systems delete older files in `/tmp` from time to time. If supervisord is running but its socket is gone, restart supervisord, and it makes a new one: `brew services restart supervisor`, or `sudo systemctl restart supervisor`. This restarts your programs too.

Then move the socket out of `/tmp`. Change `file=` under `[unix_http_server]` and `serverurl=` under `[supervisorctl]` together, to a folder nothing cleans, such as Homebrew’s `var/run`, and restart supervisord once more.

## “refused connection” instead

```text
unix:///tmp/supervisor.sock refused connection
```

The socket file is there, but nothing answers on it. Usually supervisord crashed or was killed and left its old socket behind. Start supervisord again: it removes a stale socket by itself, and prints `Unlinking stale socket` with the path when it does.

With `http://localhost:9001 refused connection`, supervisorctl talks to supervisord over a port, set by `[inet_http_server]`. Check that the `port=` there matches the `serverurl=` under `[supervisorctl]`.

## Permission denied

If supervisorctl prints a Python error ending in `Permission denied`, supervisord is running and the socket exists, but your user can’t open it. Usually root started supervisord. See [Permission denied on the socket](https://getvisor.dev/docs/troubleshooting/#permission-denied-on-the-socket).

## With Visor

Visor finds the socket in supervisord’s config. When nothing answers there, the dashboard says *Nothing answers at* followed by the socket or address. In [Doctor](https://getvisor.dev/docs/doctor/#supervisord-isnt-running), **Start supervisord** starts it as you, never with sudo; for Homebrew’s config it runs `brew services start supervisor`. When supervisord fails to start, Doctor shows what it printed and the end of its log. If Visor finds no config in the usual places, Doctor asks *Where is your config?*. More in [Troubleshooting](https://getvisor.dev/docs/troubleshooting/#supervisord-isnt-running).