# Janus on MacOS

**URL:** <https://swi-prolog.discourse.group/t/janus-on-macos/7284>\
**Category:** General\
**Created:** [March 7, 2024, 11:23pm UTC](https://swi-prolog.discourse.group/t/janus-on-macos/7284 "2024-03-07T23:23:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![free-variation](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/free-variation/32/3363_2.png) [@free-variation](https://swi-prolog.discourse.group/u/free-variation)\
**Post date:** [March 7, 2024, 11:23pm UTC](https://swi-prolog.discourse.group/t/janus-on-macos/7284/1 "2024-03-07T23:23:05Z")

</div>

Hi,

swipl 9.2.2 (via homebrew) on MacOs 13.2.1.

Out of box, attempting to load the janus library threw an error saying that the Python dynamic lib couldn’t be found. `janus.so` seems to want Python 3.9.0.

I figured that it would just be a matter of setting something like `DYLD_LIBRARY_PATH` but it seems that Apple has locked things down further so that now the dynamic lib search path is burned into the binary.

To get things to work I had to (1) install Python 3.9 (2) physically alter `jason.so` using the `install_name_tool` utility to add paths under `\usr\local\` to Python 3.9, and then sprinkle various symlinks around so that the search for the dylib could succeed. It’s a bit byzantine.

Is anyone else using Janus on a Mac?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [March 8, 2024, 8:04am UTC](https://swi-prolog.discourse.group/t/janus-on-macos/7284/2 "2024-03-08T08:04:40Z")

</div>

That is a Homebrew issue. Well, also a bit of a Python issue. Each version of Python comes with a C API that is typically not binary compatible with other versions. So, you are stuck with the version of Python used to build Janus ☹ There is something called a “Python 3 library” that offers a somewhat limited consistent interface and loads the currently installed Python version. However, this only seems to be in use for the [Python.org](http://Python.org) Windows distribution of Python.

So, as is, you need to compile Janus against the Python you want to use. That is not a big issue when installing from source, but it makes binary distributions rather impractical. If anyone knows a way around, please stand up.

Note that you can use `otool` to modify the dynamic library dependencies. I wonder whether that may help making some version transitions. Janus should work with version 3.6 or later. There are a couple of compile time decisions that choose between older and later APIs, notably wrt. Python initialization.

---

<div class="post-metadata">

**Author:** ![free-variation](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/free-variation/32/3363_2.png) [@free-variation](https://swi-prolog.discourse.group/u/free-variation)\
**Post date:** [March 8, 2024, 5:03pm UTC](https://swi-prolog.discourse.group/t/janus-on-macos/7284/3 "2024-03-08T17:03:52Z")

</div>

Thanks Jan. Yeah, `install_name_tool` is part of the `otool` set, and that’s what I used to change the RPATH set in `janus.so`. I guess in general the answer is as you say, to build from source …

If only the Python world were as lucid and elegant as that of SWI Prolog …
