Reputation: 371
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.
Upvotes: 37
Views: 80854
Reputation: 1463
If you download the SWI-Prolog application into your /Applications
folder, then add this to your .bash_profile
:
export PATH="/Applications/SWI-Prolog.app/Contents/MacOS:$PATH"
The swipl
binary lives in that MacOS directory. (Don't forget to source ~/.bash_profile
after)
Upvotes: 5
Reputation: 3510
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
.
Upvotes: 90
Reputation: 114767
Homebrew has moved swi-prolog to the top a few days ago and because of this, the other answers are not valid anymore. The reason for that: the swi-prolog formula was located in the x11 bottle but the x11 dependency is only optional.
As of today, to install swi-prolog with homebrew, simply do:
brew install swi-prolog
If you've installed it from the x11 bottle before, consider to uninstall an reinstall from the new location. Otherwise you might run into errors when updating/upgrading.
Upvotes: 6
Reputation: 124
The OSX EI Captian has this command for swi-prolog installation
brew install homebrew/x11/swi-prolog
Upvotes: 6
Reputation: 18663
There are three sensible ways of installing SWI-Prolog on MacOS X, in increasing order of complexity:
Download the SWI-Prolog application. In this case, you just download a disk image, open it, and drag the application to your disk (e.g. to your Applications
folder. You use the application as any other application by double-clicking on its icon. If you want to also use the binary inside the application bundle, add the Contents/MacOS
directory inside it to your system path (for example, assuming that you copied the SWI-Prolog application to your applications folder, do export PATH=/Applications/SWI-Prolog.app/Contents/MacOS:$PATH
in your shell configuration file).
Using MacPorts. Assuming it's installed and up-to-date, simply type either sudo port install swi-prolog
for the stable version or sudo port install swi-prolog-devel
for the development version. Replace sudo port install
by sudo port -u upgrade
when upgrading the installed version. It you're already using MacPorts, then /opt/local/bin
should already be in your system path. Type echo $PATH
in a Terminal
window to check.
Compiling from sources. In this case, download the source archive, uncompress it, and follow the instructions in the README.MacOSX
file.
Upvotes: 14