Ubuntu [SOLVED]: emacs ocaml REPL: "Searching for program: no such file or directory, ocaml"

Ubuntu [SOLVED]: emacs ocaml REPL: "Searching for program: no such file or directory, ocaml"

Home Forums Ubuntu Ubuntu [SOLVED]: emacs ocaml REPL: "Searching for program: no such file or directory, ocaml"

Tagged: , , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36434

    Anonymous

    QuestionQuestion

    I’m trying to set up OCaml in Ubuntu 16.04.3 on VirtualBox. I’m new to all of them; please pardon my ignorance. I installed opam using

    wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
    

    and added

    . /home/<username>/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
    

    to my ~/.profile file according to the instructions following the opam installation. I installed tuareg using opam install tuareg and GNU emacs 24.5.1 using sudo apt-get install emacs.

    When I tried to use the ocaml REPL by typing M-x run-ocaml and return in emacs, I got OCaml REPL to run: ocaml; when I hit enter again, I got

    Searching for program: no such file or directory, ocaml
    

    I then tried M-x shell to see if I can run ocaml from shell, and I noticed that I need to use opam switch every time I want to run ocaml from the terminal/shell; if I directly type ocaml, I would get

    The program 'ocaml' is currently not installed. You can install it by typing: sudo apt-get install ocaml-interp
    

    I’m not sure whether this has anything to do with the problem I’m getting.

    As a second try, I went back to emacs and typed M-x run-ocaml, hit return, and hit return again at OCaml REPL to run: (this time without the ocaml). This opened up a new buffer:

    output file descriptor closed

    But when I tried to type things in the new buffer, say 1+1;;, and hit shift-return, I get Output file descriptor of OCaml is closed, as shown above.

    I’ve been reading different documentations and threads for instructions, but none of them quite describe my situation. Any help would be much appreciated!

    #36435

    Anonymous

    Accepted AnswerAnswer

    Maybe you should try something like M-x run-ocaml, return, and then type something like /usr/bin/opam config exec -- ocaml (or whatever the path to your opam installation) instead of ocaml

    Source: https://stackoverflow.com/questions/47870286/emacs-ocaml-repl-searching-for-program-no-such-file-or-directory-ocaml
    Author: ghilesZ
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.