Opam init error on Mac

Hi Everyone,

My goal is to have utop on my machine in order to proceed with Real World OCaml. I am using Mac OS X High Sierra 10.13.6.

I installed the ocaml package with brew and this works fine.

[22:42:22]tamas@Galaxy:opam-2.0.0-rc3 $ ocaml -version
The OCaml toplevel, version 4.02.3

I also installed the opam package with brew

[22:07:37]tamas@Galaxy:~ $ opam --version
2.0.0~rc3

but the init command fails:

[22:42:30]tamas@Galaxy:opam-2.0.0-rc3 $ opam init
[NOTE] Will configure from built-in defaults.
Checking for available remotes: rsync and local, git.

  • you won’t be able to use mercurial repositories unless you install the hg command on your system.
  • you won’t be able to use darcs repositories unless you install the darcs command on your system.

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not update repository “default”: OpamDownload.Download_fail(_, “Download command failed: “/usr/local/bin/wget --content-disposition -t 3 -O
/private/var/folders/sj/2r7p419s1rj6wtq92vw48lb80000gn/T/opam-2020-e7966f/index.tar.gz.part https://opam.ocaml.org/index.tar.gz -U opam/2.0.0~rc3” exited with
code 5”)
Unable to locally verify the issuer’s authority.
For the unsecure connection to the opam.ocaml.org machine use the --no-check-certificate switch.
[ERROR] Initial download of repository failed

Can anyone suggest further steps to resolve it?
Thank you!

1 Like

I’ve never had this error yet, so I cannot really help
 Nevertheless, I suggest you install OCaml through opam instead of doing it separately. It will allow you to reach packages and change OCaml versions more easily. Moreover, your OCaml version seems to be quite old ! You could try to run opam switch 4.07.0 for example, to install the latest version.

Homebrew definitely needs to be updated with a newer version of OCaml.

Anyway, in this particular case, your wget has an SSL certificate problem. You might want to make sure to install wget via homebrew.

MacPorts is another option for bootstrapping your OCaml setup on a Mac, though it is a bit tricky to have MacPorts and Brew operating at the same time.

Thank to @cloudyhug, @bluddy and perry for their advices. The working solution is based on their ideas.

My brew installation had to be completely removed and installed again from scratch. I also installed wget from brew. Then came opam and after that ocaml and finally utop.

Hence one more happy ocaml learner in the universe! :slight_smile:

Thank you for your quick responses and being helpful!

Cheers,
stamas

1 Like
# opam init 4.06.1
[NOTE] Will configure from built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.


<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><>  đŸ« 
[ERROR] Could not update repository "default": rsync failed
[ERROR] Initial download of repository failed

My workaround was this:

opam init github git+https://github.com/ocaml/opam-repository.git

But I would have liked the default rsync method to work out of the box even on a mac