Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running prolog on a mac

I am having the hardest trouble trying to run SWI-prolog on my Mac.

When I type:

/opt/bin/local/swipl 

I get an error saying:

/opt/local/bin/swipl: No such file or directory 

When I just type "swipl" I get:

swipl: command not found 

I've tried this on both terminal and XQuartz. I've even gone into

/Applications/SWI-Prolog.app/Contents/MacOS 

to see if that would do anything, however the prolog "Welcome" text never appears. Quite possibly the closest I ever got it to work was when I typed "pl" when inside the MacOS folder. However I was left with my terminal doing nothing and had to use Crtl-D.

Is there something I'm doing wrong? Did I install something incorrectly?

I'm running on a Mac OS X 10.9.1 Mavericks. I placed the SWI-Prolog application into my application folder and I also downloaded XQuartz per recommendation by the website.

like image 207
user3278629 Avatar asked Feb 06 '14 08:02

user3278629


People also ask

How do I run Prolog in terminal?

Open a terminal (Ctrl+Alt+T) and navigate to the directory where you stored your program. Open SWI-Prolog by invoking swipl . In SWI-Prolog, type [program] to load the program, i.e. the file name in brackets, but without the ending. In order to query the loaded program, type goals and watch the output.

How do I know if Prolog is installed?

Then check your installation, call SWI-Prolog from a terminal shell as follows: - In the shell, type in …> ./swipl which should open the interpreter, i.e., you should see something like … ?- If you get an error that the command swipl is not known, check that your PATH variable includes a path to SWI-Prolog.


1 Answers

If you have Homebrew installed, you can simply run

brew install swi-prolog 

from Terminal, which will build it from source in one command.

You can then run the interpreter using swipl.

like image 125
Simon Hartcher Avatar answered Sep 22 '22 13:09

Simon Hartcher