[Teaching] Getting OCaml set up on a mac

Yaron Minsky yminsky at janestreet.com
Fri Jan 23 02:58:10 GMT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot-emacs
Type: application/octet-stream
Size: 2481 bytes
Desc: not available
URL: <http://lists.ocaml.org/pipermail/teaching/attachments/20150122/0e0c317d/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dot-merlin
Type: application/octet-stream
Size: 85 bytes
Desc: not available
URL: <http://lists.ocaml.org/pipermail/teaching/attachments/20150122/0e0c317d/attachment-0001.obj>


More information about the Teaching mailing list