Search code examples
bashterminalpathocamlopam

Bash - installing Ocaml-top


I am trying to install Ocaml-Top IDE from command line. I have already installed Ocaml and OPAM using Homebrew (brew install opam, brew install ocaml), but when I enter:

opam install ocaml-top

I get

[ERROR] No OPAM root found at /Users/student/.opam.

Do I need to add this to my PATH?

UPDATE: Suggestion helped, but there is an issue with the package name: I get

[ERROR] No package named ocaml-top found.

Solution

  • You appear to have missed the following caveat, notably opam init, when you ran brew install opam:

    $ brew info opam
    ...
    ==> Caveats
    OPAM uses ~/.opam by default for its package database, so you need to
    initialize it first by running (as a normal user):
    
    $  opam init
    
    Run the following to initialize your environment variables:
    
    $  eval `opam config env`
    
    To export the needed variables every time, add them to your dotfiles.
      * On Bash, add them to `~/.bash_profile`.
      * On Zsh, add them to `~/.zprofile` or `~/.zshrc` instead.
    
    Documentation and tutorials are available at https://opam.ocaml.org, or
    via "man opam" and "opam --help".
    
    Bash completion has been installed to:
      /usr/local/etc/bash_completion.d
    
    zsh completions have been installed to:
      /usr/local/share/zsh/site-functions