Following the installation and setup instructions for ocaml tool chain from Real World Ocaml book.
An issue arise after setting up utop, the .ocamlinit containing :
cause an error when ocaml interactive shell start :
OCaml version 4.13.1
Unknown directive `require'.
Since any issue arise before, I don’t think I’ve forgotten some steps.
I can provide more information if needed.
Any advice will be appreciated, thanks in advance !
#require is a top-level instruction from
ocamlfind which is loaded by
utop but not by the
ocaml top-level (by default). The error should thus go away if you try starting
You can also add the below as a first line to
~/.ocamlinit if you want this to work under the
ocaml top-level too:
Ok, I’ve investigated more on utop, and I’ve decided to create an init.ml file for utop and remove the content of .ocamlinit.
I will follow the Book with utop repl.
Thanks a lot
What was the error you had with utop? You’ll typically have a much smoother experience working through RWO with utop instead of the vanilla OCaml toplevel.