# Ocaml debugger for Visual Studio Code

**URL:** <https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557>\
**Category:** Learning\
**Created:** [October 19, 2019, 6:06am UTC](https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557 "2019-10-19T06:06:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NavnathKumbhar](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/navnathkumbhar/32/1893_2.png) [@NavnathKumbhar](https://discuss.ocaml.org/u/NavnathKumbhar)\
**Post date:** [October 19, 2019, 6:06am UTC](https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557/1 "2019-10-19T06:06:15Z")

</div>

Hello,

I am trying to give full language support for OCaml in Visual Studio Code.  
I have already installed this extension : [https://marketplace.visualstudio.com/items?itemName=freebroccolo.reasonml](https://marketplace.visualstudio.com/items?itemName=freebroccolo.reasonml)  
This gave me possibility to the features like code completion, jump to definition etc. But it does not provide debugging feature.

I want to debug my OCaml source code inside Visual Studio Code.  
I already installed this Ocaml Debugger extension : [https://marketplace.visualstudio.com/items?itemName=hackwaly.ocaml-debugger](https://marketplace.visualstudio.com/items?itemName=hackwaly.ocaml-debugger)

But it does not even provide an option to create launch file.

Do you have any suggestion to debug the Ocaml code?  
I really need it as I am new to Ocaml and I am working on another developer’s big code base and debugger will help me to understand it in less time.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![rand](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/rand/32/3055_2.png) [@rand](https://discuss.ocaml.org/u/rand)\
**Post date:** [October 22, 2019, 7:38pm UTC](https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557/2 "2019-10-22T19:38:02Z")

</div>

There exist an ocaml debugger, but personally I havn’t had much sucessful experience in using it - so I would recommend that you use print-debugging as an OCaml newcomer

---

<div class="post-metadata">

**Author:** ![hongchangwu](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hongchangwu/32/1146_2.png) [@hongchangwu](https://discuss.ocaml.org/u/hongchangwu)\
**Post date:** [October 24, 2019, 11:46pm UTC](https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557/3 "2019-10-24T23:46:34Z")

</div>

Have you tried the [example launch configuration](https://github.com/hackwaly/ocamlearlybird#example-launch-configuration) in the README?

A few things to keep in mind:

- You need to install the debug adapter first (`opam install earlybird`)
- You may need to create the `launch.json` file manually (under the `.vscode` directory in your project).
- The debugger only works with bytecode executables. Depending on your build system, you may need to build the bytecode executable first. If you are using `dune`, you can do that easily (e.g. `dune build src/main.bc`).

Hope this helps.

---

<div class="post-metadata">

**Author:** ![support](https://avatars.discourse-cdn.com/v4/letter/s/85e7bf/32.png) [@support](https://discuss.ocaml.org/u/support)\
**Post date:** [May 23, 2023, 10:29am UTC](https://discuss.ocaml.org/t/ocaml-debugger-for-visual-studio-code/4557/4 "2023-05-23T10:29:38Z")

</div>

hi @hongchangwu ,  
I followed your instructions, including the video, but I encountered an error while executing the “make examples” commands. Could you please suggest a solution for resolving this error? I have attached a screenshot of the error to this post.

 ![errmessage1](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/d/d3444ae9f0f5fe6d8de8e750577b40f53e27bde2.png)

thanks,
