Tuareg can't find ocaml

I had this problem when I was working with a Mac, too. IIRC, I figured out the command-line path to invoke Emacs.app from a Terminal, and then invoked it after setting environment variables properly; then everything worked properly.

Alternatively, surely there’s an emacs variable you can set to for the path-to-ocaml-binary, no?

But even if you did that, if you want to use opam switches, you’ll want to set environment variables before running ocaml. For that I found the “inopam” script that someone posted a while back to be very useful:

#!/bin/bash

set -e

switch="$1"
shift

mkdir -p /tmp/debugopam
if [ "$1" = "opam" ] ; then
  cmd="$@ --debug-level 2 2> /tmp/debugopam/err_$switch"
else
  cmd="$@"
fi
OPAMDEBUGSECTIONS="GSTATE SYSTEM" # to retrieve only a subset of debug infos
exec opam exec --switch "$switch" --set-switch --set-root -- "$cmd"
# clean debug files as everything succeed ; or remove them by hand to not automatise an rm
if [ $? -eq 0 ]; then
  rm /tmp/debugopam/err_*
fi

Here’s the original post: Newbie tip: using multiple projects/switches from command line and emacs
My version of the script is longer, b/c there was a bug, and one of the opam maintainers suggested this modification as a fix.