# Cannot build CPLEX even with correct environment variable

**URL:** <https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234>\
**Category:** Optimization (Mathematical)\
**Tags:** cplex\
**Created:** [September 13, 2022, 8:47pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234 "2022-09-13T20:47:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richard0416](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/richard0416/32/21563_2.png) [@Richard0416](https://discourse.julialang.org/u/Richard0416)\
**Post date:** [September 13, 2022, 8:47pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/1 "2022-09-13T20:47:53Z")

</div>

Hello!

I am trying to add CPLEX to Julia. I download the latest version of CPLEX, 22.1 And also updated the CPLEX.jl package to the latest version, v0.9.4. When running Pkg.build(“CPLEX”), it seems that the path is wrong, so I correct the path to ENV[“CPLEX\_STUDIO\_BINARIES”] = “/Applications/CPLEX\_Studio221/cplex/bin/x86-64\_osx/”, which is the correct path. But it still throws the same error. I have attached the screenshot.

Thanks!

Richard.

 ![Screenshot 2022-09-13 at 4.46.43 PM](https://global.discourse-cdn.com/julialang/original/3X/a/5/a5a670428b3f6e863541c6e4e2ebe0f96e222c39.jpeg)

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 13, 2022, 9:41pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/2 "2022-09-13T21:41:58Z")

</div>

What is `versioninfo()`?

Note that CPLEX doesn’t support M1 yet: [CPLEX.jl does not support Apple M1 · Issue #384 · jump-dev/CPLEX.jl · GitHub](https://github.com/jump-dev/CPLEX.jl/issues/384)

---

<div class="post-metadata">

**Author:** ![Richard0416](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/richard0416/32/21563_2.png) [@Richard0416](https://discourse.julialang.org/u/Richard0416)\
**Post date:** [September 13, 2022, 9:53pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/3 "2022-09-13T21:53:38Z")

</div>

Thanks Oscar for your prompt reply. Julia version is 1.8.1. I see, it is the because I am using an M2 machine. Thanks for pointing it out!

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [September 13, 2022, 10:07pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/4 "2022-09-13T22:07:15Z")

</div>

It should work with the Rosetta build of Julia.

---

<div class="post-metadata">

**Author:** ![ekara](https://avatars.discourse-cdn.com/v4/letter/e/bc79bd/32.png) [@ekara](https://discourse.julialang.org/u/ekara)\
**Post date:** [June 8, 2023, 4:50pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/5 "2023-06-08T16:50:01Z")

</div>

Hi Richard, I’m having a similar issue. Did you find any solution?

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [June 8, 2023, 9:14pm UTC](https://discourse.julialang.org/t/cannot-build-cplex-even-with-correct-environment-variable/87234/6 "2023-06-08T21:14:33Z")

</div>

Hi @ekara, welcome to the forum.

Can you please start a new thread, and include the full text of the error you get when installing CPLEX, as well as the output of `versioninfo()` and `import Pkg; Pkg.status()`.

If you’re using an M1 or M2 Mac, then you need to make sure you’ve installed the matching builds of Julia and CPLEX. So both builds with `arm64` in their name, or both builds with `x86_64`.
