SublimeREPL icon indicating copy to clipboard operation
SublimeREPL copied to clipboard

OCaml UTOP REPL doesn't work

Open ilch1 opened this issue 9 years ago • 2 comments

When trying to use OCaml utop, I receive the following:

Welcome to utop version 1.17 (using OCaml version 4.02.1)!

Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads


***Repl Closed***

Running utop from a terminal or emacs works as expected. Any idea of what could be wrong?

ilch1 avatar Jan 17 '16 22:01 ilch1

i just get ***Repl Closed*** :/

nolefp avatar Feb 22 '17 02:02 nolefp

@ilch1 @nolefp My workaround:

  1. Find and open the ~/Library/Application Support/Sublime Text 3/Packages/SublimeREPL/config/OCaml/Main.sublime-menu.
  2. Locate the extend_env field in the utop section. The default looks like:
"extend_env": {
    "OCAML_TOPLEVEL_PATH": "{HOME}/.opam/system/lib/stublibs:/usr/lib/ocaml/stublibs",
    "CAML_LD_LIBRARY_PATH": "{HOME}/.opam/system/lib/toplevel",
    "PATH": "{PATH}:{HOME}/.opam/system/bin"
},
  1. Look up OCAML_TOPLEVEL_PATH and CAML_LD_LIBRARY_PATH by running the command opam config env in your shell.
  2. Fill in the two fields with what the opam config env tells you. Then it looks like:
"extend_env": {
    "OCAML_TOPLEVEL_PATH": "/Users/<yourname>/.opam/4.04.2/lib/toplevel",
    "CAML_LD_LIBRARY_PATH": "/Users/<yourname>/.opam/4.04.2/lib/stublibs",
    "PATH": "{PATH}:{HOME}/.opam/system/bin"
},
  1. After that I get a working utop repl in Sublime.

Disclaimer: I'm new to OCaml and Sublime. There should be a better way to fix this issue. I hope the workaround works for you and that you still have faith in OCaml and Sublime. :P

jinyangustc avatar Sep 02 '17 14:09 jinyangustc