[Teaching] Getting OCaml set up on a mac

Yaron Minsky yminsky at janestreet.com
Tue Jan 27 14:47:34 GMT 2015


Lovely.  Hopefully it's smooth sailing from here...

(Famous last word)

y
On Jan 27, 2015 9:31 AM, "Greg Morrisett" <greg at eecs.harvard.edu> wrote:

> Thanks to Kenichi Asai, I’ve gotten this fixed.  The issue is that
> the .elc files weren’t wiped out from the previous buggy version
> of tuareg.  Deleting those fixed the problem.
>
> -Greg
>
> > On Jan 26, 2015, at 10:31 AM, Yaron Minsky <yminsky at janestreet.com>
> wrote:
> >
> > And the version of Tuareg is the one from opam?  Did you try
> > Christophe's suggestion of getting the HEAD release?
> >
> > y
> >
> > On Mon, Jan 26, 2015 at 10:02 AM, Greg Morrisett <greg at eecs.harvard.edu>
> wrote:
> >> One possible difference is that I’m using MacPorts instead of
> >> Homebrew.  But I’m not sure why that would cause these problems.
> >> I explicitly downloaded the latest (binary) versions of both
> >> emacs and aquamacs.
> >>
> >> -Greg
> >>
> >>> On Jan 26, 2015, at 10:00 AM, Greg Morrisett <greg at eecs.harvard.edu>
> wrote:
> >>>
> >>> The emacs version is 24.4.1.  The .emacs file is the one you sent
> >>> me.  When I fire this up, font-lock-mode is enabled, but nothing
> >>> is colorized when I load a .ml file.  If I explicitly font-lock-
> >>> fontify-buffer, and then type anything, I get the error message:
> >>>
> >>> Symbol’s function definition is void:  tuareg-syntax-propertize
> >>>
> >>> I’m going to try the most recent head of tuareg to see if this
> >>> fixes the problem.
> >>>
> >>> (NB:  same behavior under latest Aquamacs.)
> >>>
> >>> -Greg
> >>>
> >>>> On Jan 23, 2015, at 8:54 PM, Yaron Minsky <yminsky at janestreet.com>
> wrote:
> >>>>
> >>>> Hmm.  Really can't replicate the problem --- font-lock works fine for
> >>>> me.  Greg, can you email out your full .emacs?  And double-check the
> >>>> version of emacs your running?
> >>>>
> >>>> y
> >>>>
> >>>> On Fri, Jan 23, 2015 at 6:35 PM, Yaron Minsky <yminsky at janestreet.com>
> wrote:
> >>>>> That's odd. I'll look at this this weekend.
> >>>>>
> >>>>> y
> >>>>>
> >>>>> On Jan 23, 2015 11:07 AM, "Greg Morrisett" <greg at eecs.harvard.edu>
> wrote:
> >>>>>>
> >>>>>> Thanks.
> >>>>>>
> >>>>>> Your dot-emacs and dot-merlin work (with tuareg-2.0.8 which
> >>>>>> is what opam installs now.)
> >>>>>>
> >>>>>> However, font lock mode doesn’t automatically trigger on either
> >>>>>> emacs or aquamacs, in spite of the fact that I added:
> >>>>>>
> >>>>>> (global-font-lock-mode t)
> >>>>>>
> >>>>>> If I add a hook to try to explicitly turn on font-lock:
> >>>>>>
> >>>>>> (add-hook 'tuareg-mode-hook 'font-lock-fontify-buffer t)
> >>>>>>
> >>>>>> then I get the error:
> >>>>>>
> >>>>>> Warning: Bug in tuareg-mode: it forgets to call `run-mode-hooks'
> >>>>>> File mode specification error: (void-function
> tuareg-syntax-propertize)
> >>>>>>
> >>>>>> -Greg
> >>>>>>
> >>>>>>> On Jan 22, 2015, at 9:58 PM, Yaron Minsky <yminsky at janestreet.com>
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>> In the meantime, I've attached a dot-emacs and dot-merlin files
> that I
> >>>>>>> think work nicely on a mac.  The one thing you need to do is to add
> >>>>>>> this line to your .profile file:
> >>>>>>>
> >>>>>>> eval `opam config env`
> >>>>>>>
> >>>>>>> The dot emacs depends on this being in place for figuring out
> where to
> >>>>>>> find all the executables stashed in the .opam directory.
> >>>>>>>
> >>>>>>> The pre-reqs for this to work is getting tuareg downloaded and in
> the
> >>>>>>> proper path (right now, I assume ~/.elisp/tuareg-mode), and
> installing
> >>>>>>> some opam packages:
> >>>>>>>
> >>>>>>> opam install core async merlin utop ocp-indent
> >>>>>>>
> >>>>>>> This should give you merlin, ocp-indent, tuareg, and utop support,
> all
> >>>>>>> nicely integrated.  Note that the .merlin file needs to go in the
> >>>>>>> directory where you're editing code (and really, in every directory
> >>>>>>> where you're editing code.)  And the .merlin assumes that you're
> using
> >>>>>>> ocamlbuild (or corebuild) and so are putting your build artifacts
> in
> >>>>>>> _build.
> >>>>>>>
> >>>>>>> I'm hoping this is helpful.
> >>>>>>>
> >>>>>>> y
> >>>>>>>
> >>>>>>> On Thu, Jan 22, 2015 at 8:42 PM, Yaron Minsky <
> yminsky at janestreet.com>
> >>>>>>> wrote:
> >>>>>>>> On Thu, Jan 22, 2015 at 8:25 PM, Louis Gesbert
> >>>>>>>> <louis.gesbert at ocamlpro.com> wrote:
> >>>>>>>>> Thanks for the feedback. It's probably still a bit rough at the
> moment
> >>>>>>>>> but the config-updating engine is there, and polishing
> configuration itself
> >>>>>>>>> from there should be straight-forward (and never-ending).
> >>>>>>>>
> >>>>>>>> Indeed.  Now I think is the time to really focus on getting it
> >>>>>>>> working, because this is the beginning of the semester, and so
> now is
> >>>>>>>> the most valuable time to have something working cleanly.
> >>>>>>>>
> >>>>>>>> It would be good to know what we have there now.  It seems like a
> >>>>>>>> minimum should be:
> >>>>>>>>
> >>>>>>>> - tuareg
> >>>>>>>> - merlin
> >>>>>>>> - ocp-indent
> >>>>>>>> - utop
> >>>>>>>>
> >>>>>>>> all read to go in emacs.  Getting vim and sublime text support
> would
> >>>>>>>> be lovely too, but I think less critical.  What does user-setup
> >>>>>>>> already support?
> >>>>>>>>
> >>>>>>>>> The idea, with this and the "depext" package is to have a setup
> that
> >>>>>>>>> can be limited to:
> >>>>>>>>>
> >>>>>>>>> PACKAGES="user-setup merlin utop cohttp js_of_ocaml oasis
> >>>>>>>>> ocp-indent ocp-index ssl core_extended async js_of_ocaml
> core_bench cohttp
> >>>>>>>>> cryptokit menhir"
> >>>>>>>>> opam init -a
> >>>>>>>>> opam install depext
> >>>>>>>>> opam depext $PACKAGES
> >>>>>>>>> opam install $PACKAGES
> >>>>>>>>>
> >>>>>>>>> and results in a ready-to-go environment. This is in particular
> >>>>>>>>> targetted at VM setup, of course.
> >>>>>>>>
> >>>>>>>> Interesting. Concretely, what would would depext do in this
> context?
> >>>>>>>> I did a fresh install of a number of packages on my mac, and I
> didn't
> >>>>>>>> need much else, but I may have already had the dependencies in
> place
> >>>>>>>> via brew.
> >>>>>>>>
> >>>>>>>> y
> >>>>>>>>
> >>>>>>>>>> - Yaron Minsky, 22/01/2015 10:56 -
> >>>>>>>>>> It installed cleanly for me, but it doesn't quite work.  I
> installed
> >>>>>>>>>> user-setup, merlin, ocp-indent, tuareg, utop, core and async.
> It all
> >>>>>>>>>> went through, but when I open a .ml file, it shows up in lisp
> mode,
> >>>>>>>>>> not tuareg.
> >>>>>>>>>
> >>>>>>>>> Seems it doesn't handle the opam-installed tuareg package well
> at the
> >>>>>>>>> moment, should be fixed in a moment.
> >>>>>>>>>
> >>>>>>>>>> On Thu, Jan 22, 2015 at 10:54 AM, Greg Morrisett
> >>>>>>>>>> <greg at eecs.harvard.edu> wrote:
> >>>>>>>>>>> Okay, I just followed these steps:
> >>>>>>>>>>>>
> >>>>>>>>>>>> opam update
> >>>>>>>>>>>> opam install user-setup
> >>>>>>>>>>>
> >>>>>>>>>>> and it seems to be hanging.  Is there a log file or
> >>>>>>>>>>> other config information that I can send you to help
> >>>>>>>>>>> figure this out?
> >>>>>>>>>
> >>>>>>>>> Thanks. I just managed to reproduce on OPAM 1.1 and hope to fix
> it
> >>>>>>>>> quickly.
> >>>>>>>>
> >>>>>>>> Greg, it's also probably a good idea to encourage your students to
> >>>>>>>> upgrade to the latest opam if they're on a mac.  Homebrew is
> pretty
> >>>>>>>> lightweight, and has opam 1.2.0.
> >>>>>>>>
> >>>>>>>> y
> >>>>>>> <dot-emacs><dot-merlin>
> >>>>>>
> >>>>>
> >>>
> >>> _______________________________________________
> >>> Teaching mailing list
> >>> Teaching at lists.ocaml.org
> >>> http://lists.ocaml.org/listinfo/teaching
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/teaching/attachments/20150127/54395365/attachment-0001.html>


More information about the Teaching mailing list