# Can't install async 0.17.0 on macOS 15.4

**URL:** <https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468>\
**Category:** Ecosystem\
**Tags:** async\
**Created:** [April 9, 2025, 8:19pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468 "2025-04-09T20:19:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)\
**Post date:** [April 9, 2025, 8:19pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/1 "2025-04-09T20:19:36Z")

</div>

I experienced this confusing errors when installing async

```auto
=== install 5 packages
  ∗ async v0.17.0
  ∗ async_log v0.17.0 [required by async]
  ∗ async_unix v0.17.0 [required by async]
  ∗ core_unix v0.17.0 [required by async]
  ∗ textutils v0.17.0 [required by async]

Proceed with ∗ 5 installations? [y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
⬇ retrieved async_log.v0.17.0 (cached)
⬇ retrieved async_unix.v0.17.0 (cached)
⬇ retrieved async.v0.17.0 (cached)
⬇ retrieved textutils.v0.17.0 (cached)
⬇ retrieved core_unix.v0.17.0 (cached)
[ERROR] The compilation of core_unix.v0.17.0 failed at "dune build -p core_unix -j 7".

#=== ERROR while compiling core_unix.v0.17.0 ==================================#
# context 2.2.1 | macos/arm64 | ocaml-option-flambda.1 ocaml-variants.5.3.0+options | https://opam.ocaml.org#fa0e8c74bf53d0b4373e7cf144e08b669d2d1970
# path ~/.opam/5.3.0-flambda/.opam-switch/build/core_unix.v0.17.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p core_unix -j 7
# exit-code 1
# env-file ~/.opam/log/core_unix-53446-b53dc2.env
# output-file ~/.opam/log/core_unix-53446-b53dc2.out
### output ###
# [...]
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o time_ns_unix/src/time_ns_unix.cmxa time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix __.cmx time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix__ Time_ns_unix_intf.cmx time_ns_unix/src/.time_ns_unix.objs/native/time_ns_unix.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-LfkfM8DO' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o interval_unix/src/interval_unix.cmxa interval_unix/src/.interval_unix.objs/native/interval_unix __.cmx interval_unix/src/.interval_unix.objs/native/interval_unix__ Interval_unix_intf.cmx interval_unix/src/.interval_unix.objs/native/interval_unix.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-8dKreaZZ' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-xIswM1LF' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o linux_ext/src/linux_ext.cmxa -cclib -llinux_ext_stubs linux_ext/src/.linux_ext.objs/native/linux_ext __.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__ Epoll_intf.cmx linux_ext/src/.linux_ext.objs/native/linux_ext __Epoll.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__ Linux_ext_intf.cmx li[...]
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-c4EMaJ9Z' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-BpO9aCrI' (errno=Operation not permitted)
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o lock_file_blocking/src/lock_file_blocking.cmxa lock_file_blocking/src/.lock_file_blocking.objs/native/lock_file_blocking.cmx)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-1AowZdTq' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-CuvZyXGT' (errno=Operation not permitted)

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build core_unix v0.17.0
└─

```

A few questions:

```auto
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -a -o linux_ext/src/linux_ext.cmxa -cclib -llinux_ext_stubs linux_ext/src/.linux_ext.objs/native/linux_ext __.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__ Epoll_intf.cmx linux_ext/src/.linux_ext.objs/native/linux_ext __Epoll.cmx linux_ext/src/.linux_ext.objs/native/linux_ext__ Linux_ext_intf.cmx li[...]

```

I’m on macOS… but why these Linux-related line appear? Hmm not sure.

```auto
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-LfkfM8DO' (errno=Operation not permitted)
# ar: error: couldn't create cache file '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV' (errno=Operation not permitted)

```

Not sure if write permission issue is the cause. Manually creating the file works, e.g

```auto
$ touch '/var/folders/42/7rwmfsfs4rl6jv1xl12n88gc0000gp/T/xcrun_db-3YSaI2pV'

```

and my macOS account is non-admin. Any working solution for this problem?

---

<div class="post-metadata">

**Author:** ![ninjaaron](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/ninjaaron/32/1885_2.png) [@ninjaaron](https://discuss.ocaml.org/u/ninjaaron)\
**Post date:** [April 9, 2025, 8:28pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/2 "2025-04-09T20:28:02Z")

</div>

I can’t speak directly to this myself, but I did see this thread recently which seems relevant. Might be worth a look.

> [@Error compiling core\_unix](https://discuss.ocaml.org/t/error-compiling-core-unix/16429):
>
> Hello OCaml community, I try to install core\_unix on my Mac Book air M1 2020 macos Version 15.4 I get this error: [ERROR] The compilation of core\_unix.v0.17.0 failed at "dune build -p core\_unix -j 7". #=== ERROR while compiling core\_unix.v0.17.0 ==================================# # context 2.3.0 | macos/arm64 | ocaml.5.3.0 | https://opam.ocaml.org#1b767795a4e028a4d45f916f1598c24ee7a7b6cb # path ~/.opam/default/.opam-switch/build/core\_unix.v0.17.0 # command ~/.opam/opam-init/h…

---

<div class="post-metadata">

**Author:** ![kit-ty-kate](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kit-ty-kate/32/5953_2.png) [@kit-ty-kate](https://discuss.ocaml.org/u/kit-ty-kate)\
**Post date:** [April 9, 2025, 10:29pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/3 "2025-04-09T22:29:09Z")

</div>

It looks like Xcode got an update recently. I was also able to reproduce locally.  
I was able to fix it by applying the following change to `~/.opam/opam-init/hooks/sandbox.sh`:

```diff
diff --git a/src/state/shellscripts/sandbox_exec.sh b/src/state/shellscripts/sandbox_exec.sh
index 0703721f3..6b27563db 100644
--- a/src/state/shellscripts/sandbox_exec.sh
+++ b/src/state/shellscripts/sandbox_exec.sh
@@ -7,7 +7,7 @@ set -ue
 POL='(version 1)(allow default)(deny network*)(deny file-write*)'
 POL="$POL"'(allow network* (remote unix))'
 POL="$POL"'(allow file-write* (literal "/dev/null") (literal "/dev/dtracehelper"))'
-POL="$POL"'(allow file-write* (regex #"^(/private)?(/var)?/tmp/"))'
+POL="$POL"'(allow file-write* (regex #"^(/private)?(/var)?/tmp/" #"^(/private)?/var/folders/" #"^(/private)?/var/db/mds/"))'
 
 add_mounts() {
     if [-d "$2"]; then

```

This is a copy of [what macports does](https://github.com/macports/macports-base/blob/cdc24369d92b76d828ffe17ec63051f3d1a6aa76/src/port1.0/portsandbox.tcl#L92). I’m not entirely sure if it makes the sandbox too permissive or not ([previous discussions and bug-reports to Apple](https://github.com/ocaml/opam/pull/4797) were inconclusive) but it looks like we’ll need to apply something of the sort and make a point release of opam tomorrow to fix that.

---

<div class="post-metadata">

**Author:** ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)\
**Post date:** [April 10, 2025, 4:36am UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/4 "2025-04-10T04:36:15Z")

</div>

> [@kit-ty-kate](#):
>
> `POL="$POL"'(allow file-write* (regex #"^(/private)?(/var)?/tmp/" #"^(/private)?/var/folders/" #"^(/private)?/var/db/mds/"))'`

Just updated to XCode 16.3 few days ago. Your suggestion fixed the “ar: error: couldn’t create cache file…”. But introduced another error:

```auto
⬇ retrieved async_log.v0.17.0 (cached)
⬇ retrieved async_unix.v0.17.0 (cached)
⬇ retrieved async.v0.17.0 (cached)
⬇ retrieved textutils.v0.17.0 (cached)
⬇ retrieved core_unix.v0.17.0 (cached)
[ERROR] The compilation of core_unix.v0.17.0 failed at "dune build -p core_unix -j 7".

#=== ERROR while compiling core_unix.v0.17.0 ==================================#
# context 2.2.1 | macos/arm64 | ocaml-option-flambda.1 ocaml-variants.5.3.0+options | https://opam.ocaml.org#fa0e8c74bf53d0b4373e7cf144e08b669d2d1970
# path ~/.opam/5.3.0-flambda/.opam-switch/build/core_unix.v0.17.0
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p core_unix -j 7
# exit-code 1
# env-file ~/.opam/log/core_unix-8370-a9fa73.env
# output-file ~/.opam/log/core_unix-8370-a9fa73.out
### output ###
# ./thread_id.h:12:23: note: expanded from macro 'GET_THREAD_ID'
# [...]
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:744:6: note: 'syscall' has been explicitly marked deprecated here
# 744 | int syscall(int, ...);
# | ^
# 4 warnings generated.
# (cd _build/default/unix_pseudo_terminal/src && /bin/bash -e -u -o pipefail -c './discover.sh config_ext.h /Users/andretampubolon/.opam/5.3.0-flambda/lib/jst-config/config.h')
# getconf: no such configuration parameter `GNU_LIBC_VERSION'
# (cd _build/default && /Users/andretampubolon/.opam/5.3.0-flambda/bin/ocamlopt.opt -w -40 -g -I time_float_unix/time_unix/.time_unix.objs/byte -I time_float_unix/time_unix/.time_unix.objs/native -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base/base_internalhash_types -I /Users/andretampubolon/.opam/5.3.0-flambda/lib/base/md5 -I /User[...]
# File "time_float_unix/time_unix/time_unix.ml", line 1, characters 4-14:
# 1 | [@@@deprecated "[since 2022-04] Use [Time_float_unix] instead"]
# ^^^^^^^^^^
# Warning 53 [misplaced-attribute]: the "deprecated" attribute cannot appear in this context

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build core_unix v0.17.0
└─

```

Hmmm perhaps I’ll try downgrading OCaml…

---

<div class="post-metadata">

**Author:** ![kit-ty-kate](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/kit-ty-kate/32/5953_2.png) [@kit-ty-kate](https://discuss.ocaml.org/u/kit-ty-kate)\
**Post date:** [April 10, 2025, 10:59pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/5 "2025-04-10T22:59:01Z")

</div>

Yes, `core_unix` isn’t currently available on arm64 with OCaml 5.3 (see [janestreet/core\_unix#14](https://github.com/janestreet/core_unix/issues/14)). I’m not sure why nobody encoded that in the package in opam-repository so i’ve done it in [ocaml/opam-repository#27742](https://github.com/ocaml/opam-repository/pull/27742). Once this is merged, opam will now tell you that the package is unavailable on that platform

---

<div class="post-metadata">

**Author:** ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)\
**Post date:** [April 12, 2025, 4:17pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/6 "2025-04-12T16:17:45Z")

</div>

I see. On other hand, no issue installing base, async etc on OCaml 5.2. Guess I’ll stick with it until Janestreet devs fix the issue properly.

---

<div class="post-metadata">

**Author:** ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)\
**Post date:** [April 13, 2025, 1:48pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/7 "2025-04-13T13:48:10Z")

</div>

Out of curiosity, I installed OCaml 5.3.0, and then async (base works fine). New error messages:

```auto
$ opam install async
[ERROR] Package conflict!
  * No agreement on the version of ocaml-variants:
    - (invariant) → ocaml-variants = 5.3.0+options
    - async → core_kernel < v0.14 → ocaml < 4.12.0 → ocaml-variants < 4.10.3~
    You can temporarily relax the switch invariant with `--update-invariant'
  * Missing dependency:
    - async → core < v0.16 → ocaml < 4.12.0 → ocaml-base-compiler = 4.10.0 | ocaml-system >= 4.10.0 | ocaml-variants < 4.10.1~
    unmet availability conditions: '!(os = "macos" & arch = "arm64")'
    unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.0"'
    unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'
  * Missing dependency:
    - async → core < v0.16 → ocaml < 4.12.0 → ocaml-base-compiler = 4.10.1 | ocaml-system >= 4.10.1 | ocaml-variants < 4.10.2~
    unmet availability conditions: '!(os = "macos" & arch = "arm64")'
    unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.1"'
    unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler < 3.07+1 | ocaml-system < 3.07+1 | ocaml-variants < 3.8~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions: 'sys-ocaml-version = "3.07"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.07+1 | ocaml-system = 3.07+1 | ocaml-variants < 3.8~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions: 'sys-ocaml-version = "3.07+1"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.07+2 | ocaml-system = 3.07+2 | ocaml-variants < 3.8~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions: 'sys-ocaml-version = "3.07+2"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.0 | ocaml-system >= 3.08.0 | ocaml-variants < 3.08.1~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.0"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.1 | ocaml-system >= 3.08.1 | ocaml-variants < 3.08.2~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.1"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.2 | ocaml-system >= 3.08.2 | ocaml-variants < 3.08.3~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.2"'
    no matching version
  * Missing dependency:
    - async → core_kernel < v0.13 → base < v0.13 → ocaml < 4.10.0 → ocaml-base-compiler = 3.08.3 | ocaml-system >= 3.08.3 | ocaml-variants < 3.08.4~
    unmet availability conditions: 'arch != "arm64" & arch != "arm32" & arch != "ppc64"'
    unmet availability conditions, e.g. 'sys-ocaml-version = "3.08.3"'
    no matching version
....
....
...

```

Oh well 😅

---

<div class="post-metadata">

**Author:** ![mseri](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mseri/32/91_2.png) [@mseri](https://discuss.ocaml.org/u/mseri)\
**Post date:** [April 14, 2025, 6:54am UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/8 "2025-04-14T06:54:39Z")

</div>

I agree that the error message is not helpful. It stems from the incompatibility of core\_unix with ocaml 5.3 mentioned above and merged as [`core_unix.v0.17.0` does not build on OCaml 5.3 by Leonidas-from-XIV · Pull Request #27737 · ocaml/opam-repository · GitHub](https://github.com/ocaml/opam-repository/pull/27737)

---

<div class="post-metadata">

**Author:** ![mseri](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/mseri/32/91_2.png) [@mseri](https://discuss.ocaml.org/u/mseri)\
**Post date:** [April 15, 2025, 9:22am UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/9 "2025-04-15T09:22:55Z")

</div>

We just merged the core\_unix v0.17.1 release that fixes this issue. If you point at the git opam-repository url, you can already run `opam update` and use it. Otherwise it should be available within a few hours

---

<div class="post-metadata">

**Author:** ![anta40](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/anta40/32/4064_2.png) [@anta40](https://discuss.ocaml.org/u/anta40)\
**Post date:** [April 15, 2025, 3:49pm UTC](https://discuss.ocaml.org/t/cant-install-async-0-17-0-on-macos-15-4/16468/10 "2025-04-15T15:49:12Z")

</div>

Yep, upgrading core\_unix to 0.17.1 solves the async installation issue.
