Search code examples
macosterminalprologswi-prolog

Running SWI Prolog via Terminal Mac


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)


Solution

  • 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.