Pack_install(tokenize) failed on macOS

Wanted to try the package and used pack_install as in the subject on MacOS. The .zip was downloaded but the installation failed. I don’t understand what to do from the error messages below. Any suggestions on how to fix this?
Thank you.

?- pack_install(tokenize).
% Contacting server at ... ok
Install tokenize@1.0.1 from Y/n? 
ERROR: /private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/
ERROR:    /private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/ Initialization goal raised exception:
ERROR:    dlopen(/private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/, 0x0001): Library not loaded: '/usr/local/opt/zstd/lib/libzstd.1.dylib'
  Referenced from: '/private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/'
  Reason: tried: '/usr/local/opt/zstd/lib/libzstd.1.dylib' (no such file), '/usr/local/lib/libzstd.1.dylib' (no such file), '/usr/lib/libzstd.1.dylib' (no such file)
ERROR:    In:
ERROR:      [55] throw(error(shared_object(open,'dlopen(/private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/, 0x0001): Library not loaded: \'/usr/local/opt/zstd/lib/libzstd.1.dylib\'\n  Referenced from: \'/private/var/folders/qt/pkj_bbgn65zblkm1m_pn3vk80000gn/T/AppTranslocation/524304D2-B159-4F3E-8EA0-E89CF83206E9/d/\'\n  Reason: tried: \'/usr/local/opt/zstd/lib/libzstd.1.dylib\' (no such file), \'/usr/local/lib/libzstd.1.dylib\' (no such file), \'/usr/lib/libzstd.1.dylib\' (no such file)'),context(...,_5510878)))
ERROR:      [53] <meta call>
ERR ...

If this were my problem I would just short circuit the error and download and copy the Prolog code directly onto my machine.

I took a quick peek at the two files and did not see anything that looked other than just Prolog code but don’t hold my feet to the fire.


Thanks. I will try that next. However, if anyone knows why pack_install is not working (bad setup for me in macOS etc) may help others too.

Hm, the error doesn’t look like it has anything to do with the tokenize pack in particular, but that your swipl isn’t able to load libzstd to extract the archive. How did you install SWI? Are you able to install any other packs?

1 Like

Hi, I installed in the recommended way on Mac.

What is the recommended way? The binary bundle? Macports? Homebrew? From source? Which SWI-Prolog version? Which MacOS version? Intel/M1?

The stack trace is quite clear something is wrong with the libarchive extension.

Hi jan,
I used swipl-8.4.1-1.x86_64.dmg,
macOS: 12.5.1
processor: 2.2 GHz Quad-Core Intel Core i7.

I just tried


was given the option to use .git or the zip file. I picked zip first and that failed. I picked .git the second time and that succeeded.


failed with:

ERROR: source_sink `list_util' does not exist
ERROR:   [20] throw(error(existence_error(source_sink,list_util),_2044))
ERROR:   [16] '$resolve_source_path'(list_util,_2076,[if(not_loaded),...]) at /Applications/
ERROR:   [15] '$load_file_e'(list_util,user,[if(not_loaded),...]) at /Applications/
ERROR:   [14] '$load_file'(list_util,user,[if(not_loaded),...]) at /Applications/
ERROR:    [9] toplevel_call(user:user: ...) at /Applications/

I tried


again but it did not give me the .git option and the zip option failed before so I cancelled.

This git versions need git rather than libarchive to unpack. tokenize can be installed fine on the current 8.5.20 release (tested using the bundled app on Monterey running on an M1). That also installes list_util. I don’t know what use_library/1 does, but the system

 ?- use_module(library(list_util)).

works fine.

8.4.1 is old. 8.4.3 might work (not tested), 9.0, based on 8.5.20 will be released soon.

Hi jan,
Thank you very much.
I will upgrade to 8.5.20 and retry.

It was a problem with my mac missing various libraries. The problem resolved after I did a “brew upgrade” and added some missing libraries.
Thanks to everyone for their suggestions.