Prolog for Mac

Let's assume that you need to set up Prolog for OS X. If you are still here let's continue.

After reading some book from 80s about Prolog I found that language to be interesting and I decided to write some simple things in it. But I had to install it somehow on my Mac preferably without any stupid virtual machines. So here's what I ended with.

  • All crossplatform solutions are based on Eclipse, so first of all you need Eclipse. There are a lot of versions, but I chose the one with less stuff I don't need because I won't use anything related to Java development.
  • The first plugin I tested was PDT which is too old and doesn't work with Eclipse 3.5, I downloaded 3.1 but haven't tested it because I got another plugin which works — ProDT. This is just what I need. From Downloads you should choose the smallest file.
  • For ProDT to work you need SWI-Prolog — some kind of opensource Prolog.
  • I'm not sure if SWI-Prolog requires MacPorts, but anyway I recommend you to install it. It's useful.
  • Extract ProDT to eclipse/dropins/prodt/eclipse/plugins, run eclipse which installs it automatically.
  • After that in ProDT preferences (Eclipse -> Preferences -> Prolog -> Compilers -> Swi Compiler) set compiler path which is at /opt/local/bin/swipl.
  • Switch to Prolog view Window -> Show Perspective -> Other... -> Prolog.

That's it. Now you can test if it actually works:

yes(one).
yes(two).

Run and write in console:

yes(X).
x = one;
x = two.