I'm trying to compile prolog's code on sublime text 3 but I always get
[Errno 2] No such file or directory: 'swipl'
[cmd: ['swipl', '-f', '', '-t', 'main', '--quiet']]
[dir: /Applications/Sublime Text.app/Contents/MacOS]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]
because I don't know how to modify the path to swipl on sublime. Some help?
Thanks
You'll need to create a new build system for Prolog. First, I assume that you already have swipl
installed and it is on your $PATH
. Open Terminal and run the command
which swipl
to find you where it is located, then copy the full path. For example, it may return /usr/local/bin/swipl
. Then, in Sublime, create a new JSON file with the following contents:
{
"cmd": ["/usr/local/bin/swipl", "-f", "$file_name", "-t", "main", "--quiet"],
"working_dir": "$file_path",
"file_regex": "^Warning: (.+):([0-9]+)",
"selector": "source.prolog"
}
substituting "/usr/local/bin/swipl"
for the actual path you copied earlier. Save this in your Packages/User
directory (~/Library/Application Support/Sublime Text 3/Packages/User
) as Prolog_swipl.sublime-build
.
Then, go to Tools -> Build System
and select Prolog_swipl
. You should now be able to build your code using ⌘B. Make sure that your file is saved before building.