Running SWI Prolog via Terminal Mac

20,637

Solution 1

I removed the GUI version in my applications folder. Don't need it to run SWI-Prolog from command line. Simply go to terminal window and type in:

brew tap homebrew/x11

after the above command executes, enter:

brew install swi-prolog --HEAD

and now swipl should work:

Maryams-MacBook-Pro:~ maryam$ swipl

returns

Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.3.3)
Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to redistribute it under certain conditions.
Please visit http://www.swi-prolog.org for details.

For help, use ?- help(Topic). or ?- apropos(Word).

Yay! ready to go. Let's test this:

?- ['/Users/maryam/Downloads/familyTree.pl'].

true.

Solution 2

You can try to install Swi-prolog as follows:

sudo port -d selfupdate

sudo port install swi-prolog

After this, you can check the installed Swi-prolog (swipl) at

/opt/local/bin/

And now it should work

swipl




Welcome to SWI-Prolog (Multi-threaded, 64 bits, Version 7.2.2)
 Copyright (c) 1990-2015 University of Amsterdam, VU Amsterdam
 SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software,
 and you are welcome to redistribute it under certain conditions.
 Please visit http://www.swi-prolog.org for details.

 For help, use ?- help(Topic). or ?- apropos(Word).

 ?-
Share:
20,637
Tavi
Author by

Tavi

Updated on July 06, 2020

Comments

  • Tavi
    Tavi almost 4 years

    I'm trying to run prolog from terminal. I have installed version 7.2.2 and added it to my environment path using the command:

    PATH=$PATH:/Applications/SWI-Prolog.app/Contents/MacOS
    

    Then to get started I typed

    swipl
    

    but this error gets returned instead:

    Illegal instruction: 4
    

    I am new to this, kindly help me out. I know I can run the application by double clicking on it but I'm more comfortable working from the terminal..

    My Mac version is Mac OS X Lion 10.7.5 (11G63)