Setting up Prolog

Getting Started on Windows

If you're wanting to get Prolog up and running on your PC, there's an easy self-installing executable available for you to download at swi-prolog.org.

Getting Started on Mac

If you're wanting to get Prolog up and running on your Mac, you're lucky in that since OS X is based on a BSD code base this is pretty easy. There is a download on swi-prolog.org that runs on xquartz, but you don't want that! It is a much better experience to build this from the source to run natively. This guide is intended to help you get started. The first thing you'll want to do is install a package manager if you're not already using one. Believe me when I say this is the way to go.

Homebrew

Homebrew is a package manager for OS X. It's not the only one, but it's my personal favorite. Rather than re-invent the wheel, I'll direct you to either Homebrew's Webpage or a more involved guide. Both can get you where you need to be which is with homebrew installed on your Mac. Even though we're going to use homebrew to install Prolog, you can use homebrew to install MacVim, Emacs, Bison, GCC and all other kinds of usseful tools.

Installing Prolog

Now that you have homebrew installed, installing prolog is as easy as opening a terminal window and typing

brew install swi-prolog

Text Editor

You will find it helpful to have a text editor installed and running to write your Prolog code. I recommend GVim or Emacs. You can find information on Vim at vim.org, but you can download it for Windows here or install it on your Mac using homebrew. There's a MacVim project too if you just don't like homebrew. Instructions for installing Emacs are available at the gnu website. They have an executable for Windows users and recommend homebrew for installing on Mac.

Rsync

Now that you have Prolog up and running, you might find the need to transfer files from your computer to the CSCE department's Linux machines. One easy way to use this is to use rsync. There are other ways to do this, but this is the one I prefer. Rsync generally uses the format:

rsync <source file or folder> <destination file or folder>
For example, if my username was aaron and I wanted to put files from ~/Classes/CSCE330 on my laptop to a directory called 330 on the department linux machine, I would use the following command
rsync -avz -e "ssh -p 222" ~/Classes/CSCE330 aaron@l-1d39-01.cse.sc.edu:~/330
If I wanted to get files from the linux machine, I would just reverse the source and destination like so
rsync -avz -e "ssh -p 222" aaron@l-1d39-01.cse.sc.edu:~/330 ~/Classes/CSCE330
This works for individual files too.

Remote Access

When I'm using a Mac, I usually just SSH in via the terminal and that has always worked well for me although there are other options out there. If you're using Windows, there are a couple of really good and free SSH clients that you can use to SSH into the department linux machines. Putty is the one that I usually use but if you're going to be sending alot of files back and forth, Bitvise is a really good option. Honestly, it's file transfer interface is very nice. Another great option that Dr. Valtorta brought to my attention is MobaXTerm. This has the advantage of including an X11 server so you can run applications with more than just a command line interface. There are other options too, but there are the best in my opinion.

Aliases

On my Mac, I like to use aliases for longer commands that I use, but not often enough to remember them. Create a .bash_profile file in your home directory (cd ~ if you're not sure). Inside that file you can create aliases like

alias usc='ssh -l aaron -p 222 l-1d39-01.cse.sc.edu'
You can also modify your path or do other convenient things here.

tar and gzip for submissions

Let's say that you have a folder called hw1 that has the code for your first homework assignment in it. You would run


tar cvf hw1.tar hw1
gzip hw1.tar
      
And then load you .tz file to the deparment dropbox.