# Universal binaries for libtorch Mac?

**URL:** <https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229>\
**Category:** compiler\
**Created:** [May 23, 2021, 8:24pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229 "2021-05-23T20:24:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![divideconcept](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/divideconcept/32/179_2.png) [@divideconcept](https://dev-discuss.pytorch.org/u/divideconcept)\
**Post date:** [May 23, 2021, 8:24pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/1 "2021-05-23T20:24:07Z")

</div>

With Apple M1 machines now available since November, is there any plan to provide universal binaries (x86\_64+ARM) for libtorch Mac ? Hopefully starting with libtorch 1.9.0 ?

thanks !

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [May 24, 2021, 2:00pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/2 "2021-05-24T14:00:34Z")

</div>

Hi,

If you try to install from nightly (and 1.9 when it will be out) from a arm python on mac, you will see that you already get an arm binary 😃  
We don’t plan to do a universal binary right now though. It will be two independent binaries that pip/conda will automatically choose for you.

Does that work for you?

---

<div class="post-metadata">

**Author:** ![divideconcept](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/divideconcept/32/179_2.png) [@divideconcept](https://dev-discuss.pytorch.org/u/divideconcept)\
**Post date:** [May 24, 2021, 3:40pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/3 "2021-05-24T15:40:34Z")

</div>

Hi @albanD that’s good to know ! Although, while it’s certainly fine for PyTorch (the python framework), it’s more an issue regarding libtorch (the c++ library, which was my primary concern, in particular because it’s embedded into consumer softwares).  
I have a [macOS/Windows software which uses libtorch for inference](https://new.steinberg.net/spectralayers/). I’m planning to port it to x86\_64+ARM M1 by the end of the year; however it entirely depends if libtorch is also available in that format as well.

If universal binary is not available for libtorch, it’d be nice to at least have libtorch x86\_64 and libtorch ARM M1 as two downloads, which I can then [probably stitch into an universal binary library](https://stackoverflow.com/questions/1300218/create-a-universal-binary-from-two-apps).

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [May 24, 2021, 3:50pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/4 "2021-05-24T15:50:17Z")

</div>

I am not sure we have an arm libtorch yet indeed.

cc @malfet

- Do we have a convenient way for users to create universal binaries (both python and libtorch)? (even if we don’t distribute them) Or they would have to modify the build by hand?
- Do we have an arm libtorch?

---

<div class="post-metadata">

**Author:** ![divideconcept](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/divideconcept/32/179_2.png) [@divideconcept](https://dev-discuss.pytorch.org/u/divideconcept)\
**Post date:** [August 18, 2021, 8:43pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/5 "2021-08-18T20:43:15Z")

</div>

Upping this @albanD @malfet , as I’m being asked more and more about native Apple Silicon support, but can’t provide it until there are universal binaries for libtorch… Anything on the roadmap on your side ?

---

<div class="post-metadata">

**Author:** ![albanD](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/alband/32/9_2.png) [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Post date:** [August 18, 2021, 9:58pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/6 "2021-08-18T21:58:24Z")

</div>

Hi,

We should definitely be able to help you with that.  
Could you open an issue on github (and link it here) so that it doesn’t get lost?

---

<div class="post-metadata">

**Author:** ![malfet](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/malfet/32/129_2.png) [@malfet](https://dev-discuss.pytorch.org/u/malfet)\
**Post date:** [August 18, 2021, 10:22pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/7 "2021-08-18T22:22:12Z")

</div>

Sorry for the late reply. If you have a PR in mind that would add universal support for our existing builds, please do not hesitate to share it and I will gladly review/merge it.

---

<div class="post-metadata">

**Author:** ![divideconcept](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/divideconcept/32/179_2.png) [@divideconcept](https://dev-discuss.pytorch.org/u/divideconcept)\
**Post date:** [August 19, 2021, 8:36am UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/8 "2021-08-19T08:36:44Z")

</div>

@albanD I created an issue here: [universal binaries for libtorch on mac (x86\_64+arm) · Issue #63558 · pytorch/pytorch · GitHub](https://github.com/pytorch/pytorch/issues/63558)  
@malfet unfortunately I don’t know much about the libtorch building process… I’m only downloading the premade binaries through [pytorch.org](http://pytorch.org)

---

<div class="post-metadata">

**Author:** ![vellamike](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/vellamike/32/400_2.png) [@vellamike](https://dev-discuss.pytorch.org/u/vellamike)\
**Post date:** [February 2, 2022, 12:58am UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/9 "2022-02-02T00:58:32Z")

</div>

> We don’t plan to do a universal binary right now though. It will be two independent binaries that pip/conda will automatically choose for you.

@albanD what is the status of this? It would be great if you could provide the ARM binary from the downloads page. Right now I have a workaround which is getting the libs by doing a python install, but it’s very hacky.

---

<div class="post-metadata">

**Author:** ![seemethere](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/seemethere/32/403_2.png) [@seemethere](https://dev-discuss.pytorch.org/u/seemethere)\
**Post date:** [February 3, 2022, 7:15pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/10 "2022-02-03T19:15:01Z")

</div>

We currently produce universal binaries for `pytorch` but have no plan to actively support this for libtorch just yet. This might get included in the 1.12 release if there’s community support for it but PyTorch releng isn’t actively looking at this right now.

---

<div class="post-metadata">

**Author:** ![iiSeymour](https://yyz2.discourse-cdn.com/flex036/user_avatar/dev-discuss.pytorch.org/iiseymour/32/450_2.png) [@iiSeymour](https://dev-discuss.pytorch.org/u/iiSeymour)\
**Post date:** [March 14, 2022, 3:17pm UTC](https://dev-discuss.pytorch.org/t/universal-binaries-for-libtorch-mac/229/11 "2022-03-14T15:17:48Z")

</div>

Until official builds of libtorch are supported here is a _pretty_ clean work around of using the macosx arm64 wheels without needing to involve Python:

> <https://github.com/pytorch/pytorch/issues/63558#issuecomment-1066916150>
>
> \## 🚀 Feature
> Universal binaries (x86\_64+arm) made available on pytorch.org for …the libtorch library on mac.
> 
> \## Motivation
> 
> C++ applications requires libtorch to run PyTorch models saved as torchscript models.
> All new Apple computers are now using Apple Silicon/M1 processors instead of Intel processors, and thus there is an increasing demand for native Apple Silicon support for mac applications.
> As the developer of \[a C++ mac application using AI through PyTorch models\](https://new.steinberg.net/spectralayers/), I'm getting more and more requests for native Apple Silicon support but can't provide it until there's an universal binary version of the libtorch library.
> 
> \## Pitch
> 
> An universal binary for libtorch that could be downloaded through https://pytorch.org/ instead of the current x86\_64 version.
> 
> @albanD @malfet 
> 
> cc @ezyang @seemethere @malfet @walterddr @albanD
