# Error precompiling MATLAB.jl

**URL:** <https://discourse.julialang.org/t/error-precompiling-matlab-jl/61399>\
**Category:** General Usage\
**Tags:** question, matlab\
**Created:** [May 18, 2021, 9:55pm UTC](https://discourse.julialang.org/t/error-precompiling-matlab-jl/61399 "2021-05-18T21:55:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaoloVarraso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paolovarraso/32/25219_2.png) [@PaoloVarraso](https://discourse.julialang.org/u/PaoloVarraso)\
**Post date:** [May 18, 2021, 9:55pm UTC](https://discourse.julialang.org/t/error-precompiling-matlab-jl/61399/1 "2021-05-18T21:55:43Z")

</div>

Hi,

I am trying to use the MATLAB.jl package on my Mac. The installation seems successful but when I try to use the package I get the following error

`julia> using MATLAB`  
`[Info: Precompiling MATLAB [10e44e05-a98a-55b3-a45b-ba969058deb6]`  
`ERROR: LoadError: MATLAB is not properly installed. Please run Pkg.build("MATLAB") and restart Julia.`  
`Stacktrace:`  
` [1] error(::String) at ./error.jl:33`  
` [2] top-level scope at /Users/dp1311/.julia/packages/MATLAB/T20Ly/src/MATLAB.jl:40`  
` [3] include(::Function, ::Module, ::String) at ./Base.jl:380`  
` [4] include(::Module, ::String) at ./Base.jl:368`  
` [5] top-level scope at none:2`  
` [6] eval at ./boot.jl:347 [inlined]`  
` [7] eval(::Expr) at ./client.jl:467`  
` [8] top-level scope at ./none:3`  
`in expression starting at /Users/dp1311/.julia/packages/MATLAB/T20Ly/src/MATLAB.jl:37`  
`ERROR: Failed to precompile MATLAB [10e44e05-a98a-55b3-a45b-ba969058deb6] to` `/Users/dp1311/.julia/compiled/v1.5/MATLAB/6HSOn_F7yJF.ji.`  
`Stacktrace:`  
` [1] error(::String) at ./error.jl:33`  
` [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305`  
` [3] _require(::Base.PkgId) at ./loading.jl:1030`  
` [4] require(::Base.PkgId) at ./loading.jl:928`  
` [5] require(::Module, ::Symbol) at ./loading.jl:923`

I try to build the package but again I get back an error

`julia> Pkg.build("MATLAB")`  
` Building MATLAB → ~/.julia/packages/MATLAB/T20Ly/deps/build.log`  
`┌ Error: Error building MATLAB: `  
`│ [ Info: Detected MATLAB root folder at "/Applications/MATLAB_R2015b.app/bin"`  
`│ ERROR: LoadError: could not load library "/Applications/MATLAB_R2015b.app/bin/bin/maci64/libmx"`  
`│ dlopen(/Applications/MATLAB_R2015b.app/bin/bin/maci64/libmx.dylib, 1): image not found`  
`│ Stacktrace:`  
`│ [1] dlopen(::String, ::UInt32; throw_error::Bool) at ``/Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109`  
`│ [2] dlopen at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:109 [inlined]` `(repeats 2 times)`  
`│ [3] dlpath(::String) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Libdl/src/Libdl.jl:232`  
`│ [4] top-level scope at /Users/dp1311/.julia/packages/MATLAB/T20Ly/deps/build.jl:70`  
`│ [5] include(::String) at ./client.jl:457`  
`│ [6] top-level scope at none:5`  
`│ in expression starting at /Users/dp1311/.julia/packages/MATLAB/T20Ly/deps/build.jl:67`  
`└ @ Pkg.Operations /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:949`

Did anyone encounter a similar issue? Is there a way to solve the problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [May 19, 2021, 5:47am UTC](https://discourse.julialang.org/t/error-precompiling-matlab-jl/61399/2 "2021-05-19T05:47:16Z")

</div>

Are those files it tries to find around, somewhere else maybe? For example `/Applications/MATLAB_R2015b.app/bin/bin/maci64/libmx.dylib`

---

<div class="post-metadata">

**Author:** ![PaoloVarraso](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paolovarraso/32/25219_2.png) [@PaoloVarraso](https://discourse.julialang.org/u/PaoloVarraso)\
**Post date:** [May 20, 2021, 10:09am UTC](https://discourse.julialang.org/t/error-precompiling-matlab-jl/61399/3 "2021-05-20T10:09:06Z")

</div>

I downloaded the most recent version of Matlab and the problem was solved.
