Tavi
Tavi

Reputation: 2748

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)

Upvotes: 4

Views: 24665

Answers (3)

Shehan Jayasooriya
Shehan Jayasooriya

Reputation: 1

Check SWI-Prolog Installation: Run the following command to see if SWI-Prolog is installed: brew list --versions swi-prolog

If SWI-Prolog is installed, you should see its version listed. If it's not listed, it means SWI-Prolog is not installed via Homebrew: brew install swi-prolog

After installing SWI-Prolog, ensure that its binary directory is included in your system's PATH environment variable. You can check this by running: echo $PATH

Try running swipl again in your terminal to launch the SWI-Prolog interpreter: swipl

Upvotes: 0

Just life
Just life

Reputation: 635

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

 ?-

Upvotes: 1

Tavi
Tavi

Reputation: 2748

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.

Upvotes: 16

Related Questions