# Cannot run Ocsigen app: "Cannot create the command pipe ...lib/ocsigenserver/var/run/ocsigenserver\_command"

**URL:** https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753
**Category:** Learning
**Created:** [December 5, 2024, 3:42pm UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753 "2024-12-05T15:42:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)
#### Post date: [December 5, 2024, 3:42pm UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/1 "2024-12-05T15:42:01Z")

</div>

Hi, I’m an OCaml beginner. Probably should stick with learning the fundamentals first. Anyway, I gave [Ocsigen](https://ocsigen.org/home/intro.html) a try.

First install it (I’m on macOS Sequoia M2):

```auto
brew install ocsigenserver

```

OK, let’s create a project:

```auto
dune init project mysite

```

Then tweak the .dune file a bit:

```auto
(executable
 (public_name mysite)
 (name main)
 (libraries
  ocsigenserver
  ocsigenserver.ext.staticmod))

```

Let’s run it:

```auto
$ dune exec mysite
mysite: ocsigen:main: Cannot create the command pipe /Users/andretampubolon/.opam/5.2.0-flambda/lib/ocsigenserver/var/run/ocsigenserver_command. I will continue without.: Unix.Unix_error(Unix.ENOENT, "mkfifo", "/Users/andretampubolon/.opam/5.2.0-flambda/lib/ocsigenserver/var/run/ocsigenserver_command")

```

OK, what’s wrong here? For anyone curious, this is [the entire repo](https://github.com/anta40/mysite)

---

<div class="post-metadata">

### Author: ![Juloo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/juloo/32/881_2.png) [@Juloo](https://discuss.ocaml.org/u/Juloo)
#### Post date: [December 6, 2024, 9:37am UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/2 "2024-12-06T09:37:44Z")

</div>

This might just be a warning ? If that’s the case, the app is running fine.

The “command pipe” is used to send commands to the running server, which is probably not useful for simple apps but unfortunately is not an option.  
Here’s what works for me:

```
let _ =
  Ocsigen_server.start
    ~ports:[(`All, 8080)]
    ~command_pipe:"local/var/run/blibli-cmd" ~logdir:"local/var/log/blibli"
    ~datadir:"local/var/data/blibli" ~default_charset:(Some "utf-8")
    [

```

---

<div class="post-metadata">

### Author: ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)
#### Post date: [December 6, 2024, 3:21pm UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/3 "2024-12-06T15:21:35Z")

</div>

After further inspection, I guess indeed the app ran fine.  
Opening `http://localhost:8080` on browser gave you “Error: Not Found”. Perhaps mis-configuration.?

Then I changed the a code a bit (inspired by [this](https://ocsigen.org/ocsigenserver/latest/manual/quickstart)):

```auto
let _ =
  Ocsigen_server.start
    [Ocsigen_server.host [Staticmod.run ~dir:"/Users/andretampubolon/blah/" ()]]

```

`/Users/andretampubolon/blah/` only contains 2 text files. It still gives you “Error: Not Found”. Should it give you a directory listing, instead?

---

<div class="post-metadata">

### Author: ![Juloo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/juloo/32/881_2.png) [@Juloo](https://discuss.ocaml.org/u/Juloo)
#### Post date: [December 7, 2024, 11:15am UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/4 "2024-12-07T11:15:40Z")

</div>

> [@anta40](#):
>
> `Ocsigen_server.host`

“Error: Not Found” is what I expect from `Staticmod.run`, so everything seems to work. You should be able to create a file named `index.html` in that directory.

[Staticmod.run](https://ocaml.org/p/ocsigenserver/latest/doc/Staticmod/index.html#val-run) doesn’t seem to have an option to enable directory listing but it seems that you could perhaps add [(Extendconfiguration.listdirs true);](https://ocaml.org/p/ocsigenserver/6.0.0/doc/Extendconfiguration/index.html#val-listdirs) to the list passed to `Ocsigen_server.host`. I haven’t tested this.

---

<div class="post-metadata">

### Author: ![otini](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/otini/32/3533_2.png) [@otini](https://discuss.ocaml.org/u/otini)
#### Post date: [December 9, 2024, 5:13pm UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/5 "2024-12-09T17:13:00Z")

</div>

Regarding the command pipe error, one can avoid it by making sure the directory that’s supposed to contain the named pipe exists (that’s the origin of the error). So in this case it would have removed the message to run:

```auto
mkdir -p /Users/andretampubolon/.opam/5.2.0-flambda/lib/ocsigenserver/var/run/

```

---

<div class="post-metadata">

### Author: ![shym](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@shym](https://discuss.ocaml.org/u/shym)
#### Post date: [December 16, 2024, 6:17pm UTC](https://discuss.ocaml.org/t/cannot-run-ocsigen-app-cannot-create-the-command-pipe-lib-ocsigenserver-var-run-ocsigenserver-command/15753/6 "2024-12-16T18:17:15Z")

</div>

Actually listing directories isn’t supported (yet) by ocsigenserver but you could have a try at the [PR](https://github.com/ocsigen/ocsigenserver/pull/248) for that. 🙂
