Running prolog on a mac

user3278629 picture user3278629 · Feb 6, 2014 · Viewed 59.4k times · Source

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.

Answer

Simon Hartcher picture Simon Hartcher · May 28, 2014

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.