3

I have been installing Coq using the download links from the https://coq.inria.fr/ for both Windows and Mac. However, when I try coqc or coqtop on terminal or command prompt I get error messages saying that the command is not found. Although with that being said, I can still run Coq almost perfectly fine on the Coq IDE but when I compile buffer, in particularly the exercises from Software Foundations, i get the following message.

Running: coqc -I '/Users/zhangsheng/Desktop/G/repos/Coqy/cis500' '/Users/zhangsheng/Desktop/G/repos/Coqy/cis500/Basics.v' 2>&1

From what I understand, 2>&1 seems to be some form of misdirection and I feel that is the reason why coqc and coqtop don't seem to work on my terminal/command prompt.

Could someone kindly suggest the 'best' way to install Coq on either Mac or Windows or both such that I don't get the problems I mentioned above?

Zhangsheng
  • 85
  • 2
  • 11
  • For Mac you can use [opam](https://opam.ocaml.org) to install coq (opam is a source-based package manager for OCaml ecosystem). To install opam one can use [homebrew](http://brew.sh), which is a package manager for macOS (homebrew uses both binary and source-based packages). – Anton Trunov Jan 25 '17 at 17:55
  • 1
    @AntonTrunov: This recommendation seems to be a bit involved. Cannot Coq be installed directly from homebrew? – Zimm i48 Jan 26 '17 at 10:24
  • 1
    @Zimmi48 Oh, yes, you are right :) It's just when experimenting with Coq's versions and different packages, it's easier (for me) to use opam. – Anton Trunov Jan 26 '17 at 10:27
  • 1
    @AntonTrunov: Right, opam has some advantages, but for beginners I suppose it may result in unnecessary complications. – Zimm i48 Jan 26 '17 at 10:29
  • @AntonTrunov Thanks for your recommendation. Does using opam give me OCaml so that I can then do my installation by cloning the [Coq repo](https://github.com/coq/coq)? Would be good if I can get more explicit instructions on the installation process. – Zhangsheng Jan 26 '17 at 12:41
  • @Zimmi48 I don't mind it being involved as long as I can get a proper working version running. – Zhangsheng Jan 26 '17 at 12:41
  • You can get any OCaml version with opam. They have pretty good installation instruction on their site. You can also get a development version of Coq if you add this repo: `opam repo add coq-core-dev https://coq.inria.fr/opam/core-dev` (see [here](http://coq.io/opam/get_started.html)) – Anton Trunov Jan 27 '17 at 11:45
  • @AntonTrunov I actually installed Coq using brew and the `coqtop` and `coqc` commands now work. But now I don't have the familiar CoqIDE and even if I tried using it, the `.vo` files don't work with it. Any recommendations for which editor to use for Coq that is similar to CoqIDE? What are the difference between opam installation compared to the `.dmg` file from the Coq website? Do I get a Coq with no packages for the opam installation? Thanks for answering my questions. – Zhangsheng Jan 27 '17 at 11:57
  • (1) Sorry, I don't use CoqIDE and I haven't used the `.dmg` installer, I prefer package managers. (2) There is a tool that may be considered close to CoqIDE -- Visual Studio Code with the Coq extension for it. (3) All major Coq packages can be installed via opam (e.g. mathcomp). The packages have prefix `coq-` in their names. – Anton Trunov Jan 27 '17 at 12:04

2 Answers2

4

Although I am not a Windows or OSX user, I imagine that you're having this problem because the Coq installer does not update the system's PATH variable. This variable is a list of directories used by the terminal to look up the programs corresponding to commands you type. If you don't want to install Coq via a different method, you should probably find where the coqc and coqtop binaries are installed, and add these directories to your PATH. Here are a few references on how to do this: OSX, Windows.

Arthur Azevedo De Amorim
  • 23,012
  • 3
  • 33
  • 39
0

When using Mac, just run

brew install coq
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257