1.0 Updates:
  1. none

Mac Unix tips for LISP at DePaul

Elliott—Artificial Intelligence

Terminal Windows

Note: this is intended for Mac users that have little experience using Unix.

First, for basic use, by default Mac gives you an inconvenient prompt that can take up half of your command line. You can always set it back if you like, but let's get rid of it for now, as follows.

Your default prompt probably looks something stupid like the following:

Users-iMac-2:~ clarkelliott$ 
In the worst case we want to avoid it looking completely moronic like this:
Users-iMac-2: ~/classes/Artificial Intelligence/assginments/programs/LISP/assgin1/ clarkelliott$ 
So, let's fix it. If you already have the hidden file (see below) .bash_profile file in your home directory you have to add the one line below to it using your text editor (e.g. TextEdit—covered elsewhere). Otherwise, using your text editor, in your home directory, create a file called .bash_profile and add the following line to it, then save the file:
export PS1="> "
Then, exit your Terminal Window, start up a new Terminal Window and your prompt should look like this:
> 
Alternatively you can use $ in place of > to be consistent with bash style:
$ 
At this point, you will no longer see where you are in your directory tree as part of the prompt. But when you want to check where you are (as opposed to seeing this information repeated ad nauseum as part of the prompt) you type the print working directory command:
> pwd
~clarkelliott
Assuming you have created a directory name ~/classes/AI/LISP (or whatever) where you are going to work on your LISP programs, you might want to create a handy symbolic link to it:
> cd
> ln -s mylisp '~/classes/AI/LISP/'
Now we can easily change to that directory from anywhere in our direcory tree:
> cd
> pwd
~clarkelliott
> cd mylisp
> pwd
> ~clarkelliott/mylisp/
> ls
animal.lisp NN.lisp factorial.lisp
> cd			[<--to get back to your root directory]
If you ever want to get rid of the handy symbolic link (or if you make a mistake setting it up) use:
> unlink mylisp
Also, your symbolic shortcut should also show up in finder as well.

On the chance that you have downloaded your ablc.jar file, but don't know where it is, you can issue either of the following find commands and probably locate it:

> cd
> find . -name abcl.jar
> find . -name *.jar
If you don't see it, it's possible you have not downloaded it yet. Keep in mind that ABCL usually comes, by default, with a name like abci-bin-1.3.3.jar. To make things easier, for intro classes we typical rename it:
> mv abcl-bin-1.3.3.jar abcl.jar
Once you locate your abcl.jar file (in your Downloads directory?) copy it into the directory where you will be working on your LISP files. Starting in the directory where your ABLC.jar file is located:
> cp abcl.jar ~/mylisp/    [<-- assuming you have set up the symbolic link, as above]
> cd mylisp	
> ls
abcl.jar animal.lisp NN.lisp factorial.lisp
> 
Handy tip: In Finder on the Mac, some files and folders (e.g., .bash_profile) may be hidden from you. To see the hidden files, open the Finder and press:
 Command + Shift + .		[<--That is, end with a full stop/period]
(When you no longer want to see the hidden folders just press Command + Shift + . again.) Note: this does not seem to work on all Macs. You can always see your hidden files at the command line using "ls -a" or "ls -ls". At this point, you should have a nice clean prompt, and should be able to easily navigate to the directory where you are doing LISP development.