# XGBoost Broken for Mac Mojave and earlier - Initialization Error

**URL:** <https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731>\
**Category:** General Usage\
**Tags:** question\
**Created:** [September 3, 2022, 3:17pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731 "2022-09-03T15:17:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 3, 2022, 3:17pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/1 "2022-09-03T15:17:30Z")

</div>

I haven’t used XGBoost in a while. Now when I try to ‘use’ it, I get all sorts of errors, even when I update, and build, etc., even after fresh install of Julia.

The difficulty seems to lie with c++ modules… Does anyone know of a version of xgboost that is written in pure Julia or doesn’t have this dependency? [I came across JuML but that seems to be dead]

```julia
┌ Info: Precompiling XGBoost [009559a3-9522-5dbb-924b-0b6ed2b22bb9]
└ @ Base loading.jl:1423
ERROR: LoadError: InitError: could not load library "/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib"
dlopen(/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib, 1): Symbol not found: ___cxa_deleted_virtual
  Referenced from: /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:117
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__ ()
    @ XGBoost_jll ~/.julia/packages/XGBoost_jll/Ytq8S/src/wrappers/x86_64-apple-darwin.jl:10
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:854
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1097
  [8] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [9] require(into::Module, mod::Symbol)
...
 [15] top-level scope
    @ none:1
during initialization of module XGBoost_jll
in expression starting at /Users/davide/.julia/packages/XGBoost/D30Xd/src/XGBoost.jl:1
Failed to precompile XGBoost [009559a3-9522-5dbb-924b-0b6ed2b22bb9] to /Users/davide/.julia/compiled/v1.7/XGBoost/jl_YoEynb.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

```

Does anyone have any ideas?. I wanted to use XGBoost for the class I teach, but I can’t if this sort of thing keeps happening.  
Thanks for any help!  
\*\*\* Update!! same error persists after fresh upgrade/install to Julia 1.8

---

<div class="post-metadata">

**Author:** ![pazzo83](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pazzo83/32/232_2.png) [@pazzo83](https://discourse.julialang.org/u/pazzo83)\
**Post date:** [September 3, 2022, 6:11pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/2 "2022-09-03T18:11:43Z")

</div>

You could try EvoTrees ([https://github.com/Evovest/EvoTrees.jl](https://github.com/Evovest/EvoTrees.jl)) - that’s probably the closest approximation to XGBoost in pure Julia. I’ve also had intermittent issues with XGBoost - you might want to try a complete clean install of julia + XGBoost. Maybe you need to update something like your xcode developer tools or something. Seems like some library is missing.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 3, 2022, 6:41pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/3 "2022-09-03T18:41:27Z")

</div>

Thanks for that, I will try EvoTrees.  
[About XGBoost] Thanks for your suggestion - I did a completely fresh install and no dice. I may be able to spend a day and fix my problem, but part of the issue is that I teach 300+ Undergrads and Postgrads, and I have to constantly defend setting Julia over R or Python to my superiors, and if the most commonly used Machine Learning algorithm (xgboost) fails with a fresh (standard) installation of Julia in a class of 200, I’m ‘dead meat’ !

Anyway, thanks.

---

<div class="post-metadata">

**Author:** ![George9000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george9000/32/23619_2.png) [@George9000](https://discourse.julialang.org/u/George9000)\
**Post date:** [September 3, 2022, 8:45pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/4 "2022-09-03T20:45:37Z")

</div>

I’m running Julia 1.9 (dev) on a Mac M1 and just installed XGBoost to a new package environment without difficulty. Perhaps try one of the nightly versions of 1.9, which has been quite stable for me in daily use.

> **Step-by-step**
>
> ```julia
> $ cd Desktop
> 
> $ julia -e 'using Pkg; Pkg.generate("xg")'
> 
> $ cd xg
> 
> $ julia -e 'using Pkg; Pkg.activate("."); Pkg.instantiate()'
> 
> $ julia
> 
> julia> versioninfo()
> 
> Julia Version 1.9.0-DEV.1274
> Commit a9d3f7bb35 (2022-09-03 06:24 UTC)
> Platform Info:
> OS: macOS (arm64-apple-darwin21.6.0)
> CPU: 10 × Apple M1 Max
> WORD_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-14.0.5 (ORCJIT, apple-m1)
> Threads: 1 on 8 virtual cores
> Environment:
> JULIA_EDITOR = Emacs
> 
> ] ## switch to Pkg prompt
> 
> (xg) pkg> add XGBoost
> Updating registry at `~/.julia/registries/General.toml`
> Resolving package versions...
> Installed XGBoost_jll ──── v1.6.1+0
> Installed LLVMOpenMP_jll ─ v14.0.4+0
> Installed XGBoost ──────── v1.5.2
> Downloaded artifact: XGBoost
> Downloaded artifact: LLVMOpenMP
> Updating `~/Desktop/xg/Project.toml`
> [009559a3] + XGBoost v1.5.2
> Updating `~/Desktop/xg/Manifest.toml`
> [692b3bcd] + JLLWrappers v1.4.1
> [21216c6a] + Preferences v1.3.0
> [009559a3] + XGBoost v1.5.2
> [1d63c593] + LLVMOpenMP_jll v14.0.4+0
> [a5c6f535] + XGBoost_jll v1.6.1+0
> [0dad84c5] + ArgTools v1.1.1
> [56f22d72] + Artifacts
> [2a0f44e3] + Base64
> [ade2ca70] + Dates
> [f43a241f] + Downloads v1.6.0
> [7b1f6079] + FileWatching
> [b77e0a4c] + InteractiveUtils
> [b27032c2] + LibCURL v0.6.3
> [76f85450] + LibGit2
> [8f399da3] + Libdl
> [37e2e46d] + LinearAlgebra
> [56ddb016] + Logging
> [d6f4376e] + Markdown
> [ca575930] + NetworkOptions v1.2.0
> [44cfe95a] + Pkg v1.8.0
> [de0858da] + Printf
> [3fa0cd96] + REPL
> [9a3f8284] + Random
> [ea8e919c] + SHA v0.7.0
> [9e88b42a] + Serialization
> [6462fe0b] + Sockets
> [2f01184e] + SparseArrays
> [10745b16] + Statistics
> [fa267f1f] + TOML v1.0.0
> [a4e569a6] + Tar v1.10.0
> [8dfed614] + Test
> [cf7118a7] + UUIDs
> [4ec0a83e] + Unicode
> [e66e0078] + CompilerSupportLibraries_jll v0.5.2+0
> [deac9b47] + LibCURL_jll v7.84.0+0
> [29816b5a] + LibSSH2_jll v1.10.2+0
> [c8ffd9c3] + MbedTLS_jll v2.28.0+0
> [14a3606d] + MozillaCACerts_jll v2022.2.1
> [4536629a] + OpenBLAS_jll v0.3.20+0
> [bea87d4a] + SuiteSparse_jll v5.10.1+0
> [83775a58] + Zlib_jll v1.2.12+3
> [8e850b90] + libblastrampoline_jll v5.1.1+0
> [8e850ede] + nghttp2_jll v1.48.0+0
> [3f19e933] + p7zip_jll v17.4.0+0
> Precompiling project...
> 4 dependencies successfully precompiled in 1 seconds. 7 already precompiled.
> 
> ```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 3, 2022, 10:19pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/5 "2022-09-03T22:19:19Z")

</div>

What version of macOS do you have? As written in the error message, it requires 10.15. There’s nothing we can possibly do about, that’s a requirement from the upstream XGBoost library.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 3, 2022, 10:38pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/6 "2022-09-03T22:38:14Z")

</div>

Thanks - I hadn’t noticed that - well-spotted.

I have 10.14.6 - but only a few years old. Is there a way I can downgrade XGB to a compatible version? It used to work just fine with this OS. [Also, my students have laptops which are even older than mine]  
Thanks again

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 3, 2022, 10:52pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/7 "2022-09-03T22:52:02Z")

</div>

> [@compleat](#):
>
> Thanks - I hadn’t noticed that - well-spotted.

You know, actually reading the error messages sometimes helps 🙂

> [@compleat](#):
>
> I have 10.14.6 - but only a few years old. Is there a way I can downgrade XGB to a compatible version? It used to work just fine with this OS.

You can use `XGBoost_jll@1.5.2`.

> [@compleat](#):
>
> [Also, my students have laptops which are even older than mine]

If you have further complaints about XGBoost requiring macOS 10.15 you should direct them to XGBoost developers.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 3, 2022, 10:56pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/8 "2022-09-03T22:56:32Z")

</div>

Thank you so much. I have already raised an issue on their repo - I will update that with the new info.

Regards

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 3, 2022, 11:07pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/9 "2022-09-03T23:07:27Z")

</div>

> [@compleat](#):
>
> Thank you so much. I have already raised an issue on their repo

If you mean

> <https://github.com/dmlc/XGBoost.jl/issues/110>
>
> Hi. XGBoost seems to be broken. It failed to precompile in Julia 1.7 so I ins…talled/Julia 1.8 fresh.
> 
> \`\`\`
> julia\> using XGBoost
> │ Package XGBoost not found, but a package named XGBoost is available from a registry. 
> │ Install package?
> │ (@v1.8) pkg\> add XGBoost 
> └ (y/n/o) \[y\]: 
> Resolving package versions...
> Updating \`~/.julia/environments/v1.8/Project.toml\`
> \[009559a3\] + XGBoost v1.5.2
> Updating \`~/.julia/environments/v1.8/Manifest.toml\`
> \[009559a3\] + XGBoost v1.5.2
> \[1d63c593\] + LLVMOpenMP\_jll v14.0.4+0
> \[a5c6f535\] + XGBoost\_jll v1.6.1+0
> Precompiling project...
> ✗ XGBoost
> 2 dependencies successfully precompiled in 3 seconds. 109 already precompiled.
> 1 dependency errored. To see a full report either run \`import Pkg; Pkg.precompile()\` or load the package
> \[Info: Precompiling XGBoost \[009559a3-9522-5dbb-924b-0b6ed2b22bb9\]
> ERROR: LoadError: InitError: could not load library "/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib"
> dlopen(/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib, 1): Symbol not found: \_\_\_cxa\_deleted\_virtual
> Referenced from: /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib (which was built for Mac OS X 10.15)
> Expected in: /usr/lib/libc++.1.dylib
> in /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib
> Stacktrace:
> \[1\] dlopen(s::String, flags::UInt32; throw\_error::Bool)
> @ Base.Libc.Libdl ./libdl.jl:117
> \[2\] dlopen(s::String, flags::UInt32)
> @ Base.Libc.Libdl ./libdl.jl:116
> \[3\] macro expansion
> @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library\_generators.jl:54 \[inlined\]
> \[4\] \_\_init\_\_()
> @ XGBoost\_jll ~/.julia/packages/XGBoost\_jll/Ytq8S/src/wrappers/x86\_64-apple-darwin.jl:10
> \[5\] \_include\_from\_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
> @ Base ./loading.jl:831
> \[6\] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt64)
> @ Base ./loading.jl:1039
> \[7\] \_require(pkg::Base.PkgId)
> @ Base ./loading.jl:1315
> \[8\] \_require\_prelocked(uuidkey::Base.PkgId)
> @ Base ./loading.jl:1200
> \[9\] macro expansion
> @ ./loading.jl:1180 \[inlined\]
> \[10\] macro expansion
> @ ./lock.jl:223 \[inlined\]
> \[11\] require(into::Module, mod::Symbol)
> @ Base ./loading.jl:1144
> \[12\] include
> @ ./Base.jl:419 \[inlined\]
> \[13\] include\_package\_for\_output(pkg::Base.PkgId, input::String, depot\_path::Vector{String}, dl\_load\_path::Vector{String}, load\_path::Vector{String}, concrete\_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
> @ Base ./loading.jl:1554
> \[14\] top-level scope
> @ stdin:1
> during initialization of module XGBoost\_jll
> in expression starting at /Users/davide/.julia/packages/XGBoost/D30Xd/src/XGBoost.jl:1
> in expression starting at stdin:1
> ERROR: Failed to precompile XGBoost \[009559a3-9522-5dbb-924b-0b6ed2b22bb9\] to /Users/davide/.julia/compiled/v1.8/XGBoost/jl\_yWXGZF.
> Stacktrace:
> \[1\] error(s::String)
> @ Base ./error.jl:35
> \[2\] compilecache(pkg::Base.PkgId, path::String, internal\_stderr::IO, internal\_stdout::IO, keep\_loaded\_modules::Bool)
> @ Base ./loading.jl:1705
> \[3\] compilecache
> @ ./loading.jl:1649 \[inlined\]
> \[4\] \_require(pkg::Base.PkgId)
> @ Base ./loading.jl:1337
> \[5\] \_require\_prelocked(uuidkey::Base.PkgId)
> @ Base ./loading.jl:1200
> \[6\] macro expansion
> @ ./loading.jl:1180 \[inlined\]
> \[7\] macro expansion
> @ ./lock.jl:223 \[inlined\]
> \[8\] require(into::Module, mod::Symbol)
> @ Base ./loading.jl:1144
> \[9\] top-level scope
> @ ~/.julia/packages/CUDA/DfvRa/src/initialization.jl:52
> 
> julia\> using XGBoost
> \[Info: Precompiling XGBoost \[009559a3-9522-5dbb-924b-0b6ed2b22bb9\]
> ERROR: LoadError: InitError: could not load library "/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib"
> dlopen(/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib, 1): Symbol not found: \_\_\_cxa\_deleted\_virtual
> Referenced from: /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib (which was built for Mac OS X 10.15)
> Expected in: /usr/lib/libc++.1.dylib
> in /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib
> Stacktrace:
> \[1\] dlopen(s::String, flags::UInt32; throw\_error::Bool)
> @ Base.Libc.Libdl ./libdl.jl:117
> \[2\] dlopen(s::String, flags::UInt32)
> @ Base.Libc.Libdl ./libdl.jl:116
> \[3\] macro expansion
> @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library\_generators.jl:54 \[inlined\]
> \[4\] \_\_init\_\_()
> @ XGBoost\_jll ~/.julia/packages/XGBoost\_jll/Ytq8S/src/wrappers/x86\_64-apple-darwin.jl:10
> \[5\] \_include\_from\_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
> @ Base ./loading.jl:831
> \[6\] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt64)
> @ Base ./loading.jl:1039
> \[7\] \_require(pkg::Base.PkgId)
> @ Base ./loading.jl:1315
> \[8\] \_require\_prelocked(uuidkey::Base.PkgId)
> @ Base ./loading.jl:1200
> \[9\] macro expansion
> @ ./loading.jl:1180 \[inlined\]
> \[10\] macro expansion
> @ ./lock.jl:223 \[inlined\]
> \[11\] require(into::Module, mod::Symbol)
> @ Base ./loading.jl:1144
> \[12\] include
> @ ./Base.jl:419 \[inlined\]
> \[13\] include\_package\_for\_output(pkg::Base.PkgId, input::String, depot\_path::Vector{String}, dl\_load\_path::Vector{String}, load\_path::Vector{String}, concrete\_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
> @ Base ./loading.jl:1554
> \[14\] top-level scope
> @ stdin:1
> during initialization of module XGBoost\_jll
> in expression starting at /Users/davide/.julia/packages/XGBoost/D30Xd/src/XGBoost.jl:1
> in expression starting at stdin:1
> ERROR: Failed to precompile XGBoost \[009559a3-9522-5dbb-924b-0b6ed2b22bb9\] to /Users/davide/.julia/compiled/v1.8/XGBoost/jl\_2a45v3.
> Stacktrace:
> \[1\] error(s::String)
> @ Base ./error.jl:35
> \[2\] compilecache(pkg::Base.PkgId, path::String, internal\_stderr::IO, internal\_stdout::IO, keep\_loaded\_modules::Bool)
> @ Base ./loading.jl:1705
> \[3\] compilecache
> @ ./loading.jl:1649 \[inlined\]
> \[4\] \_require(pkg::Base.PkgId)
> @ Base ./loading.jl:1337
> \[5\] \_require\_prelocked(uuidkey::Base.PkgId)
> @ Base ./loading.jl:1200
> \[6\] macro expansion
> @ ./loading.jl:1180 \[inlined\]
> \[7\] macro expansion
> @ ./lock.jl:223 \[inlined\]
> \[8\] require(into::Module, mod::Symbol)
> @ Base ./loading.jl:1144
> \[9\] top-level scope
> @ ~/.julia/packages/CUDA/DfvRa/src/initialization.jl:52
> 
> \`\`\`
> 
> Does anyone have any ideas?
> Are there any alternative versions of xgboost that work on Julia?
> 
> Thanks for any help.

that’s the wrong repository. As I’ve been trying to tell all this time it’s the upstream project [GitHub - dmlc/xgboost: Scalable, Portable and Distributed Gradient Boosting (GBDT, GBRT or GBM) Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Dask, Flink and DataFlow](https://github.com/dmlc/xgboost) which requires macOS 10.15. But I wouldn’t hold my breath about them doing anything about that.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 4, 2022, 9:46am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/10 "2022-09-04T09:46:08Z")

</div>

> [@giordano](#):
>
> You can use `XGBoost_jll@1.5.2`.

I tried that, restarted, and got the same error.

Thanks for highlighting the issue, though.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 10:01am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/11 "2022-09-04T10:01:37Z")

</div>

> [@compleat](#):
>
> and got the same error.

Sorry if I’m skeptical, but it looks to me rather unlikely you’ve got the _ **same** _ error since `XGBoost_jll` 1.5.2 was built for macOS 10.12.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 10:05am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/12 "2022-09-04T10:05:52Z")

</div>

And in

> <https://github.com/dmlc/xgboost/issues/8223>
>
> Julia implementation of XGBoost is broken for Macs not bought within the past co…uple of years (OS \< 10.15, e.g. Mojave)
> 
> \[This is apparently due to compilation issues of a c++ library\]
> 
> Does anyone know of an alternative implementation of xgboost which is available for Julia?
> 
> I teach large (\>200) classes and few students have the latest laptops, so I cannot use xgboost for my classes as things stand.
> 
> Thanks for any help or advice.

there is _ **nothing** _ specific to Julia, it’s the C++ library itself which requires macOS 10.15! There is no “Julia implementation” of XGBoost, only a Julia package calling into the C++ library.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 4, 2022, 10:12am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/13 "2022-09-04T10:12:34Z")

</div>

> [@giordano](#):
>
> Sorry if I’m skeptical, but it looks to me rather unlikely you’ve got the _ **same** _ error since `XGBoost_jll` 1.5.2 was built for macOS 10.12.

Thanks - I would be grateful if you could please tell me where I went wrong, then:

First

```julia
using Pkg
Pkg.rm("XGBoost")
Pkg.add(Pkg.PackageSpec(; name="XGBoost", version="1.5.2"))

```

Seemed to go without a hitch. Then restart. Then:

```julia
using XGBoost

┌ Info: Precompiling XGBoost [009559a3-9522-5dbb-924b-0b6ed2b22bb9]
└ @ Base loading.jl:1423
ERROR: LoadError: InitError: could not load library "/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib"
dlopen(/Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib, 1): Symbol not found: ___cxa_deleted_virtual
  Referenced from: /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libc++.1.dylib
 in /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:117
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__ ()
    @ XGBoost_jll ~/.julia/packages/XGBoost_jll/Ytq8S/src/wrappers/x86_64-apple-darwin.jl:10
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:854
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1097
  [8] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [9] require(into::Module, mod::Symbol)
...
 [15] top-level scope
    @ none:1
during initialization of module XGBoost_jll
in expression starting at /Users/davide/.julia/packages/XGBoost/D30Xd/src/XGBoost.jl:1
Failed to precompile XGBoost [009559a3-9522-5dbb-924b-0b6ed2b22bb9] to /Users/davide/.julia/compiled/v1.7/XGBoost/jl_VyAmrv.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

```

Thanks for your help so far (and any additional).

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 10:15am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/14 "2022-09-04T10:15:17Z")

</div>

You get _ **again** _ the error on file

> [@compleat](#):
>
> ```julia
> Referenced from: /Users/davide/.julia/artifacts/18efbf9f697f68d4d6b74e269856f743e6ce7d10/lib/libxgboost.dylib (which was built for Mac OS X 10.15)
> 
> ```

`18efbf9f697f68d4d6b74e269856f743e6ce7d10` is the artifact of `XGBoost_jll` 1.6.1 for x86\_64 macOS:

> <https://github.com/JuliaBinaryWrappers/XGBoost_jll.jl/blob/fe1a55cf7479db37ca7c0595dc6621edd10eb680/Artifacts.toml#L215-L222>

Hence you are _ **not** _ using `XGBoost_jll` 1.5.2.

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 10:18am UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/15 "2022-09-04T10:18:32Z")

</div>

> [@compleat](#):
>
> `Pkg.add(Pkg.PackageSpec(; name="XGBoost", version="1.5.2"))`

You’re pinning the wrong package. I’ve been talking about `XGBoost_jll`, you pinned `XGBoost`.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 4, 2022, 2:31pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/16 "2022-09-04T14:31:47Z")

</div>

> [@giordano](#):
>
> XGBoost\_jll

Thanks, that seems to have worked.

---

<div class="post-metadata">

**Author:** ![hcho3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hcho3/32/42454_2.png) [@hcho3](https://discourse.julialang.org/u/hcho3)\
**Post date:** [September 4, 2022, 7:04pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/17 "2022-09-04T19:04:34Z")

</div>

An XGBoost project maintainer here.

There’s nothing upstream XGBoost that requires MacOS 10.15 specifically. In the Python package, we target MacOS 10.13+:

> <https://github.com/dmlc/xgboost/blob/ada4a86d1c3687ba78392993e6b2902d69175ef2/tests/ci_build/build_python_wheels.sh#L38>

Which `libxgboost.dylib` the Julia package using? Is it using Homebrew’s package ([xgboost — Homebrew Formulae](https://formulae.brew.sh/formula/xgboost)) ?

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 9:27pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/18 "2022-09-04T21:27:40Z")

</div>

Ok, it turned out [XGBoost does require 10.15](https://github.com/dmlc/XGBoost.jl/issues/110#issuecomment-1236411155), but the good news is that it was unintentional and the fix was very simple.

New build of `XGBoost_jll` (`v1.6.1+1`) includes the fix, and it should work on all macOS systems supported by Julia (\>= 10.10).

Thanks a lot @hcho3 for the quick help!

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [September 4, 2022, 9:32pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/19 "2022-09-04T21:32:41Z")

</div>

Thanks all! Does this mean my students may add XGBoost or must they specify XGBoost\_jll ?  
[not sure I understand the distinction here]

Thanks again

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [September 4, 2022, 9:35pm UTC](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731/20 "2022-09-04T21:35:19Z")

</div>

Installing `XGBoost` should just work now (the library provided by `XGBoost_jll` is installed automatically and you don’t need to pin it to a specific version anymore). BTW, I also just updated it to the latest version v1.6.2: [New version: XGBoost\_jll v1.6.2+0 by jlbuild · Pull Request #67690 · JuliaRegistries/General · GitHub](https://github.com/JuliaRegistries/General/pull/67690).

[Next page](https://discourse.julialang.org/t/xgboost-broken-for-mac-mojave-and-earlier-initialization-error/86731.md?page=2)
