3

During initialization of OPAM I got this message:

A hook can be added to opam's init scripts to ensure that the shell remains in sync with the opam environment when they are loaded. Set that up? [y/N]

Could you clarify what does this mean?

I've tried to find out it here: https://github.com/ocaml/opam/search?q=hook&unscoped_q=hook

I heard this word before, but what is "shell hook"? What it is used for? Why it asks me to choose? :)

ged
  • 687
  • 7
  • 19

1 Answers1

1

env_hook.sh adds the hook, at least in bash, scripts for other shells are similar. This will run eval $(opam env) every time the prompt is displayed. You can run opam env and check what it does, it sets some environment variables.

You need this hook for local switches, it will update the switch based on your current directory. See issue #3573 for discussion about this topic.

It's possible to change this configuration option later, just re-run opam init.

Jakub Nowak
  • 316
  • 2
  • 10