Setting up a Software Development Environment for Mac and PC

Sean E. O'Connor


I show how to set up a software development environment on Mac OS X Macs and Windows PC's. When we're done, we'll be able to develop programs in C, C++, Python, Javascript, Java, and Lisp using Unix tools.


Unix Tools Mac

Mac OS X comes with most of the the Unix utilities make, diff, gcc, g++ (the clang equivalent), lldb, etc. already installed. To get even more recent versions, you can install the free Xcode IDE.

UNIX Tools Windows

Load Cygwin utilities from Cygwin home. Choose download to disk without installing to C:/Install/Cygwin Use direct connection and pick a mirror site. Next, run setup.exe. Pick view=full. Now select all the defaults and also be sure to add bash, bison, byacc, cvs, ctags, diff, flex, gcc, g++, gdb, hexedit, ncurses, make, python, sed, tar, zip and unzip. Then run setup again but this time install from the local disk. You'll get a cygwin icon on the desktop which you can launch shell commands from.

Cygwin Setup Part 1. Cygwin Setup Part 2. Cygwin Setup Part 3.
Cygwin Setup

Bash Settings

I'm using the BASH shell. Read the Beginner's Guide, Tutorial, and Reference then go to your home directory, under C:/Documents and Settings/Sean Erik O'Connor and place the bash startup files .bash_login, .bash_logout and .bashrc there.

If your user name in your /home directory contains spaces, it will cause trouble. cygwin gets it from the windows logon name. You can edit the /etc/passwd file and change the Cygwin user name (first field), then rename your directory.

#============================================================================= # # FILE NAME # # .bash_profile # # DESCRIPTION # # bash shell startup file for Unix systems, executed upon login. # # Install into your home directory ~. Also called .profile or # .bash_login # # DATE # # 27 Jul 11 # # AUTHOR # # Sean E. O'Connor # #============================================================================= # #------------- Portability ------- # # Try to determine which system we are running on. #----------------------------------------------------------------------------- #--- Set the path #----------------------------------------------------------------------------- # Be sure to put useful scripts and executables into the home bin directory: ~/bin bins="/usr/local/bin:~/bin" # Mac OS X uses an old version of Python, python2.7.2 by default. But we want at least Python 3.x. So do the following: # 1. Install Python3 from # 2. Create a symbolic link so calling python from the command line will call the newly installed version. # cd /Library/Frameworks/Python.framework/Versions/3.x/bin ; sudo ln -s python3.5 python # python -V # 3. Python installer will append these lines to the end of this file: # Setting PATH for Python 3.5 # The orginal version is saved in .bash_profile.pysave # PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" # export PATH # Delete them. # 4. If you need to call the old version comment out this line in the .bash_profile script, py3bin="/Library/Frameworks/Python.framework/Versions/3.5/bin" ###echo "Using Mac OS X System Python version path = ${PATH}" PATH="${HOME}:${py3bin}:${bins}:${PATH}" export PATH # Make sure Python 3 is installed on your system. Get the version and redirect from stderr to stdout. python_version=`python -V 2>&1` # Delete minor versions (numbers after the first dot), and spaces, e.g. Python 3.5.0 => Python3 python_version_stripped=`echo ${python_version} | sed 's/\.[0-9]//g' | sed 's/[ \r]//g'` # Check the version and give help. if [ "${python_version_stripped}" != "Python3" ] ; then echo "WARNING: Current Python verison is ${python_version}" echo " path = $PATH ; which python" echo "Mac OS X uses an old version of Python, python2.7.2 by default. But we want at least Python 3.x. So do the following:" echo " 1. Install Python3 from" echo " 2. Python installer will append these lines to the end of this file:" echo " Setting PATH for Python 3.5" echo " The orginal version is saved in .bash_profile.pysave" echo " PATH=/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" echo " export PATH" echo " Delete them." echo " 3. Create a symbolic link named python in the Python frameworks bin directory." echo " Since the Python3 framework directory is preappended to our path, we now call the symbolic link." echo " cd /Library/Frameworks/Python.framework/Versions/3.x/bin ; sudo ln -s python3.5 python" echo " python -V" echo " 4. If you need to call the old version comment out this line in the .bash_profile script," echo " /Library/Frameworks/Python.framework/Versions/3.5/bin" fi # To set the hostname manually on Mac OS X # edit /etc/hostconfig: HOSTNAME=Artificer # sudo hostname Artificer" # sudo scutil --set LocalHostName Artificer # sudo scutil --set ComputerName Artificer # sudo scutil --set HostName Artificer # In System Preferences/Sharing change 'Computer Name' to Artificer. # In your local network configuration, rename the name provided by DHCP. # Find out the hostname. In cygwin bash, strip off the trailing \r introduced. # The alternative is to use tr -d '\r' hostname=`python -c "import platform; print( platform.node() )" | sed 's/^[ \r\n\t]*$//'` if [ "${hostname}" == "" ] ; then echo "Could not get a hostname. We will guess a Mac system!" fi # Default settings will assume we are on a Mac OS X. ls_color_option="-G" desk_dir="/Users/seanoconnor/Desktop" thumb_dir="/Volumes/ALNILAM" alias gvim=vim alias vi=gvim extra_bin_path="/usr/local/bin" # We are on a Windows XP machine instead! if [ "${hostname}" == "Sean-PC" ] || [ "${hostname}" == "peripatus" ] ; then ### echo "Overriding Mac settings --- this is a Windows machine!" ls_color_option="--color=tty" desk_dir="/cygdrive/c/cygwin/home/Sean" thumb_dir="/cygdrive/e" # Windows has endless trouble with blanks in filenames, so use DOS 8.3 equivalent file name. desk_dir="/cygdrive/c/docume~1/Sean/Desktop" alias vi=gvim fi #------------- Export base directories for use by other programs ------------- # The root directory has /Sean under it and /Sean/WebSite underneath that. export desk_dir export thumb_dir ### echo "Hostname = |${hostname}|" ### echo "Root dir |${desk_dir}|, thumb dir |${thumb_dir}|, desk_dir |${desk_dir}|" #------------- Directory Shorthands ------------- # Top level directories sean_dir="${desk_dir}/Sean" app_dir="${sean_dir}/Apps" export sean_dir export app_dir # Level 1. arts_dir="${sean_dir}/Arts" business_dir="${sean_dir}/Business" family_dir="${sean_dir}/Family" science_dir="${sean_dir}/Sciences" web_dir="${sean_dir}/WebSite" export arts_dir export business_dir export family_dir export science_dir export web_dir # Quickly cd to subdirectories by typing cd subdir. # Need . in the list to avoid having to put ./ in front of directories. export CDPATH=.:~:${sean_dir}:${pp_src_dir} # Show hidden files in finder (needs a relaunch of finder). defaults write AppleShowAllFiles TRUE # Finish up the aliases. source .bashrc export PATH

#---------------------------------------------------------------------------- # # TITLE # # .bashrc # # DESCRIPTION # # # Bourne Again Shell (bash) startup file for Unix systems. Executed # everytime we start a subshell. Install into your home directory ~. # Put aliases and functions here. # # Use source .bashrc to reset the environment after you are in a # terminal window. Place the line "source .bashrc" into .bash_profile # to execute this file's commands upon login. # # To debug, use sh -x .bashrc # # DATE # # 27 Jul 11 # # AUTHOR # # Sean E. O'Connor # #---------------------------------------------------------------------------- #------------- Aliases ------------- # # Be sure to put useful scripts and executables into the home bin directory: ~/bin # alias desk='cd ${desk_dir}' alias thum='cd ${thumb_dir}' alias sean='cd ${sean_dir}' alias app='cd ${app_dir}' alias art='cd ${arts_dir}/Visual/Painting/OriginalWorks' alias bus='cd ${business_dir}' alias fam='cd ${family_dir}' alias sci='cd ${science_dir}' alias web='cd ${web_dir}' alias math='cd ${science_dir}/Mathematics' alias comp='cd ${science_dir}/ComputerScience' alias acc='cd ${business_dir}/Accounts' web_des_dir="${web_dir}/WebDesign" alias wd='cd "${web_dir}/WebDesign"' web_main_dir="${web_des_dir}/MaintainWebPage/" alias main='cd ${web_dir}/WebDesign/MaintainWebPage' alias priv='cd ${web_dir}/private' crc_dir="${web_dir}/CommunicationTheory/ChannelCoding/Crc" alias lif='cd ${web_dir}/ComputerScience/Automata/Life' alias lis='cd ${web_dir}/ComputerScience/Compiler/ParserGeneratorAndParser/SourceCode/ParserGenerator' pp_dir="${web_dir}/Mathematics/AbstractAlgebra/PrimitivePolynomials" pp_proj_dir="${pp_dir}/Project" pp_bld_dir="${pp_dir}/Project/Build" pp_src_dir="${pp_dir}/Project/SourceCode" pp_exe_dir="${pp_bld_dir}/Bin" alias pp='cd ${pp_dir}' alias ppb='cd ${pp_bld_dir}' alias pps='cd ${pp_src_dir}/Primpoly' alias ppsc='cd ${pp_src_dir}/PrimpolyC' # Other directories. #------------- Git ------- # Location of git repository. export GITREPOS="${web_dir}/private/repos" #------------- Set prompt ------- # # Define colors for the text in a prompt. # startcolor="\[\e[" black="30" red="31" green="32" yellow="33" blue="34" magenta="35" teal="36" white="37" separator=";" blackbackground="40" redbackground="41" greenbackground="42" yellowbackground="43" bluebackground="44" magentabackground="45" tealbackground="46" whitebackground="47" reset="0" boldtext="1" underline="4" blink="5" inverted="7" endcolor="m\]" resetcolor="\e[0m" whiteonblue="${startcolor}${white}${separator}${bluebackground}${endcolor}" redonblue="${startcolor}${red}${separator}${bluebackground}${endcolor}" # Set the prompt to # time \@, date \d, user name \u, host name \h, current directory \w # \W basename of current directory, \$ if UID = 0 (root), use # instead of $ export PS1="${redonblue}\u:${whiteonblue}\w${resetcolor}\$ " ###echo ${PS1} #------------- Shell options ------------- # # Set vi edit mode for the command line. # Hit to go into vi's edit command mode: # h Move cursor left # l Move cursor right # A Move cursor to end of line and put in insert mode # 0 (zero) Move cursor to beginning of line (doesn't put in insert mode) # i Put into insert mode at current position # a Put into insert mode after current position # dd Delete line (saved for pasting) # D Delete text after current cursor position (saved for pasting) # p Paste text that was deleted # j Move up through history commands # k Move down through history commands # u Undo set -o vi # Don't wait for job termination notification set -o notify # Don't use ^D to exit set -o ignoreeof # Use case-insensitive filename globbing shopt -s nocaseglob # Make bash append rather than overwrite the history on disk shopt -s histappend # When changing directory small typos can be ignored by bash # for example, cd /vr/lgo/apaache would find /var/log/apache shopt -s cdspell shopt -s cdable_vars #------------- Completion options ------------- # # These completion tuning parameters change the # default behavior of bash_completion: # Define to avoid stripping description in --option=description of './configure --help' COMP_CONFIGURE_HINTS=1 # Define to avoid flattening internal contents of tar files COMP_TAR_INTERNAL_PATHS=1 # If this shell is interactive, turn on programmable completion enhancements. # Any completions you add in ~/.bash_completion are sourced last. case $- in *i*) [[ -f /etc/bash_completion ]] && . /etc/bash_completion ;; esac #------------- History options ------------- # # Don't put duplicate lines in the history. export HISTCONTROL="ignoredups" # Ignore some controlling instructions export HISTIGNORE="ls:ls *:[ ]*:&:cd:cd ..:exit:hi:s:f:m:um" # Whenever displaying the prompt, write the previous line to disk export PROMPT_COMMAND="history -a" #------------- Aliases ------------- # # If these are enabled they will be used instead of any instructions # they may mask. For example, alias rm='rm -i' will mask the rm # application. # # To override the alias instruction use a \ before, ie # \rm will call the real rm not the alias. # # To see all aliases, type alias. # Use unalias to remove a definition. # Interactive operation... alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias up='cd ..' # Default to human readable figures alias df='df -h' alias du='du -h' # Misc :) alias less='less -r' # raw control characters alias whence='type -a' # where, of a sort alias grep='grep --color' # show differences in colour # Some shortcuts for different directory listings alias ls='ls -hF ${ls_color_option}' alias dir='ls --color=auto --format=vertical' alias ll='ls -l' # long list alias la='ls -A' # all but . and .. alias l='ls -CF' # # Recursive (R) walk through all subdirectories generating a long list. # Skip over directories, looking at only files. # Sort numerically on the file size in column 5 in order. alias big='ls -lR | grep '^-' | sort -k 5 -n' # Clean up alias xxx='history -c ; sudo rm -rf ~/.gdb_history ~/.sh_history ~/.bash_history ~/.slime-history.eld ~/.viminfo ~/.DS_Store ; sudo rm -rf ~/temp/archive/* ; cd ; clear' #------------- Utility functions ------------- # Recursive search for a string in a file. function grepall() { if [ $# == 0 ] then echo "Usage: grepall " fi # Grab the function argument, bash style. pat=$1 echo "Searching all subdirectories for pattern ${pat}" find . -name '*.[ch]' -exec grep -iH "${pat}" {} ';' find . -name '*.hpp' -exec grep -iH "${pat}" {} ';' find . -name '*.cpp' -exec grep -iH "${pat}" {} ';' find . -name '*.py' -exec grep -iH "${pat}" {} ';' find . -name '*.m' -exec grep -iH "${pat}" {} ';' find . -name '*.js' -exec grep -iH "${pat}" {} ';' find . -name '*.java' -exec grep -iH "${pat}" {} ';' find . -name '*.pl' -exec grep -iH "${pat}" {} ';' find . -name '*.prl' -exec grep -iH "${pat}" {} ';' find . -name '*.html' -exec grep -iH "${pat}" {} ';' find . -name '*.css' -exec grep -iH "${pat}" {} ';' find . -name 'makefile' -exec grep -iH "${pat}" {} ';' } function touchall() { find . -exec touch {} ';' } function testOptions() { if [ $# == 0 ] then echo "Number of arguments to testOptions is $#" fi # No spaces around the equals allowed in bash! a1=$1 echo "You said |${a1}|" # Compare the first 3 letters. if [ "${a1:0:3}" == "tes" ] then echo "You said testOptions tes" else echo "What did you say?" fi } # Launch gvim editor. function ov() { if [ $# == 0 ] then echo "You need to give the name of a file to edit." fi open -a MacVim $1 } # Remove temporary files. function cleanall() { if [ $# != 0 ] then echo "Usage: cleanall" fi find . -name '*~' -print -exec rm -f {} \; find . -name '._*' -print -exec rm -f {} \; find . -name '.DS_Store*' -print -exec rm -f {} \; find . -name 'Thumbs.db' -print -exec rm -f {} \; find . -name '*.swp' -print -exec rm -f {} \; find . -name '*.o' -print -exec rm -f {} \; find . -name '*.class' -print -exec rm -f {} \; find . -name '*.o~$' -print -exec rm -f {} \; find . -name '*.o~>' -print -exec rm -f {} \; find . -name '*.dSYM' -print -exec rm -rf {} \; find . -name '*.obj' -print -exec rm -rf {} \; find . -name '*.ncb' -print -exec rm -rf {} \; find . -name '*.suo' -print -exec rm -rf {} \; find . -name '*.idb' -print -exec rm -rf {} \; find . -name '*.pdb' -print -exec rm -rf {} \; find . -name '*.manifest' -print -exec rm -rf {} \; find . -name '*.Spotlight-V100' -print -exec rm -rf {} \; find . -name '*.Trash*' -print -exec rm -rf {} \; find . -name '*.fseventsd' -print -exec rm -rf {} \; }

#============================================================================= # # FILE NAME # # .bash_logout # # DESCRIPTION # # bash shell executed upon logout. # Install into your home directory ~. # # DATE # # 19 Apr 10 # # AUTHOR # # Sean E. O'Connor # #============================================================================= # # Clean up. # rm -f ~/.bash_history #rm -f ~/.viminfo


I use Git for source code control. It's described in the Git Pro 2 Book. Here's an example of how I set up my Git repository for my Primpoly project using local repositories.

Git Configuration.

In your .bashrc file in home directory, add the location of the local Git repository,

#------------- Git ------- # Location of git repository. export GITREPOS="${web_dir}/private/repos"

The bash parameter ${web_dir} points to my top level web directory on my disk.

In your home directory $HOME, edit the file .gitconfig to add your email and user name plus your default editor,

[user] email = name = Sean E. O'Connor [core] editor = vim excludesfile = /Users/seanoconnor/.gitignore [merge] tool = opendiff conflictstyle = diff3 [difftool] prompt = false # Don't prompt the user to hit RETURN before the next file difference. [difftool "opendiff"] # cmd = echo 'base(ancestor base for the merge) = ' \"$BASE\" 'local(file on current branch) = ' \"$LOCAL\" 'remote(file to be merged) = ' \"$REMOTE\" 'merged(what mergetool should write) = ' \"$MERGED\" cmd = opendiff \"$LOCAL\" \"$REMOTE\" -merge \"$MERGED\" [mergetool "opendiff"] cmd = opendiff \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\" trustExitCode = true [push] default = simple [credential] helper = cache [alias] unstage = reset HEAD -- uncheckin = checkout --

and which files to ignore globally by git,

$ cd $ cat .gitignore *.html

Create a Bare Repository

Create a local directory to serve as the Git repository, make a subdirectory for the project, then initialize the repository.

cd $web_dir/private $ mkdir repos ; cd repos $ mkdir Primpoly ; cd Primpoly $ git --bare init Initialized empty Git repository in $web_dir/private/repos/Primpoly/ $ la HEAD branches/ config description hooks/ info/ objects/ refs/

Add Files to Source Code Control

Go to the directory containing the source files and initialize Git.

cd ~/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/SourceCode/Primpoly $ git init Initialized empty Git repository in /Users/seanoconnor/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/SourceCode/Primpoly/.git/

Place the source files under source code control. We don't add the html files since they are automatically generated.

$ git add *.cpp *.h /FactorTables $ git status On branch master Initial commit Changes to be committed: (use "git rm --cached ..." to unstage) new file: FactorTables/c02minus.txt ... new file: FactorTables/c12plus.txt new file: Primpoly.cpp ... new file: ppUnitTest.h Untracked files: (use "git add ..." to include in what will be committed) Primpoly.cpp.html ... ppUnitTest.h.html

Your files are staged now. When ready, do a commit,

$ git commit -m "Initial import from SVN." [master (root-commit) 75fa9b1] Initial import from SVN. 32 files changed, 46548 insertions(+) create mode 100755 FactorTables/c02minus.txt ... create mode 100755 FactorTables/c12plus.txt create mode 100755 Primpoly.cpp ... create mode 100755 ppUnitTest.h

Now we let the local directory Primpoly know about the remote repository.

$ git remote add origin $GITREPOS/Primpoly/ $ git remote show origin $ git remote -v origin ${web_dir}/private/repos/Primpoly/ (fetch) origin ${web_dir}/private/repos/Primpoly/ (push)

Then we push up to the remote repository,

$ git push origin master Counting objects: 35, done. Delta compression using up to 8 threads. Compressing objects: 100% (35/35), done. Writing objects: 100% (35/35), 1.10 MiB | 0 bytes/s, done. Total 35 (delta 2), reused 0 (delta 0) To $GITREPOS/Primpoly/ * [new branch] master -> master

To avoid specifying origin and master each time you pull and push, you can track the remote repository,

$ git pull There is no tracking information for the current branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull If you wish to set tracking information for this branch you can do so with: git branch --set-upstream-to=origin/ master $ git branch --set-upstream-to=origin/master Branch master set up to track remote branch master from origin.

Verify the git repository is set up correctly by doing a test clone from the remote repository, and verify there are no differences between it and your local repository,

$ cd ~/Desktop $ git clone $GITREPOS/Primpoly Cloning into 'Primpoly'... done. $ diff -r ~/Desktop/Primpoly \ ~/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/SourceCode/Primpoly

You can use Mac OS X mergetool/opendiff to resolve conflicts.

$ git mergetool


Somewhat long in the tooth, I use make



Mac OS X development tools contain the C++ and C compilers and Windows Cygwin gives you C++ and C compilers.

Start by reading the textbooks A Tour of C++ by Bjarne Stroustrup and The C++ Programming Language, 4th Edition then read the latest updates in the C++ Super-FAQ and the C FAQ

Microsoft Visual C++ Compiler Windows

Download Visual Studio Express and follow instructions.

C++ GUIs

I haven't tried them yet but the C++ GUIs FoxTookit and WxWidgets sound interesting. WxWidgets looks a lot like Windows API with classes. Here is a tutorial ending up with source code for a tetris game.

LLDB Debugger

I use the lldb debugger in the llvm toolchain which comes installed on Mac OS X.

# Load executable compiled with -g option. lldb Bin/Primpoly.exe (lldb) target create "Bin/Primpoly.exe" Current executable set to 'Bin/Primpoly.exe' (x86_64). # Set a breakpoint in the code. (lldb) b ppBigInt.cpp:433 Breakpoint 2: where = Primpoly.exe`BigInt::operator unsigned long() const + 18 at ppBigInt.cpp:433, address = 0x000000010000fa92 # Run the program. (lldb) run 2 4 Process 49251 launched: '/Users/seanoconnor/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/Build/Bin/Primpoly.exe' (x86_64) Primpoly Version 13.0 - A Program for Computing Primitive Polynomials. Copyright (C) 1999-2017 by Sean Erik O'Connor. All Rights Reserved. ... Process 49251 stopped * thread #1: tid = 0x8a8db2, 0x000000010000fa92 Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 18 at ppBigInt.cpp:433, queue = '', stop reason = breakpoint 2.1 frame #0: 0x000000010000fa92 Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 18 at ppBigInt.cpp:433 430 BigInt::operator ppuint() const 431 throw( BigIntOverflow, bad_exception ) 432 { -> 433 ppuint result = 0 ; 434 ppuint b = base_() ; 435 436 for (int i = static_cast( digit_.size()) - 1 ; i >= 0 ; --i) # Backtrace (lldb) bt * thread #1: tid = 0x8a8db2, 0x000000010000fa92 Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 18 at ppBigInt.cpp:433, queue = '', stop reason = breakpoint 2.1 * frame #0: 0x000000010000fa92 Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 18 at ppBigInt.cpp:433 frame #1: 0x00000001000dc1b9 Primpoly.exe`unitTest() + 16233 at ppUnitTest.cpp:641 frame #2: 0x0000000100000c89 Primpoly.exe`main(argc=3, argv=0x00007fff5fbff600) + 89 at Primpoly.cpp:162 frame #3: 0x00007fff934cd5ad libdyld.dylib`start + 1 # Step to next line. (lldb) n Process 49251 stopped * thread #1: tid = 0x8a8db2, 0x000000010000fa9d Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 29 at ppBigInt.cpp:434, queue = '', stop reason = step over frame #0: 0x000000010000fa9d Primpoly.exe`BigInt::operator unsigned long(this=0x00007fff5fbf8d18) const + 29 at ppBigInt.cpp:434 431 throw( BigIntOverflow, bad_exception ) 432 { 433 ppuint result = 0 ; -> 434 ppuint b = base_() ; 435 436 for (int i = static_cast( digit_.size()) - 1 ; i >= 0 ; --i) 437 { # List breakpoints. (lldb) br l Current breakpoints: 1: file = 'ppBigInt.cpp', line = 433, locations = 1, resolved = 1, hit count = 1 1.1: where = Primpoly.exe`BigInt::operator unsigned long() const + 18 at ppBigInt.cpp:433, address = 0x000000010000fa92, resolved, hit count = 1 2: name = 'l', locations = 0 (pending) 3: name = 'list', locations = 0 (pending) 4: name = 'l', locations = 0 (pending) # Delete all breakpoints. (lldb) br del About to delete all breakpoints, do you want to do that?: ÆY/nÅ y All breakpoints removed. (4 breakpoints) # Print a value. (lldb) p digit_ (std::__1::vector >) $4 = size=4 { [0] = 4 [1] = 3 [2] = 2 [3] = 1


Go to Python and download the latest version of Python from the site. Go to custom and make sure it installs into the correct directories on the system.

Windows On a Windows system, install into C:\Program Files\Python Go to Start/Control Panel/System/Advanced/Environment Variables and add the string ;C:\Python31; to the end of the path. For cygwin, in your Bash profile in your home directory, /cygdrive/c/cygwin/home/.bashrc, put PATH="/cygdrive/c/Python31:${PATH}" or else you can do a symbolic link, cd /usr/bin ; rm python ; ln -s /cygdrive/c/Python31/python3 python"

Mac On Mac OS, place code in your .bash_profile to set the path to Python 3.x Then run python -V to check the version is 3x and type quit() to exit. Keep the tutorial and library reference handy. Or better yet, download the whole set.

If you program LISP already, Python is very similar.

Common Lisp

My parser generator project is coded in Common Lisp.

Macs Download the install package for the binary from Steel Bank Common Lisp. Unpack and follow instructions.

$ sudo INSTALL_ROOT=/usr/local sh ... SBCL has been installed: binary /usr/local/bin/sbcl core and contribs in /usr/local/lib/sbcl/

You'll get a bare-bones command line REPL. Try running $ sbcl from the command line and try (car '(a b c)) and (cdr '(a b)) and (quit) For convenience, I load my LISP parser generator project files in the SBCL startup file .sbclrc

(load "/Users/seanoconnor/Desktop/Sean/WebSite/ComputerScience/Compiler/ParserGeneratorAndParser/SourceCode/ParserGenerator/LR(1)AndLALR(1)ParserGenerator.lsp") (load "/Users/seanoconnor/Desktop/Sean/WebSite/ComputerScience/Compiler/ParserGeneratorAndParser/SourceCode/ParserGenerator/LR(1)AndLALR(1)Parser.lsp") (test-parser-generator) (test-parser)

However, your life will be much easier if youw download and install Slime Unpack and install the slime directory in /Applications/slime then install this .emacs file in your home directory:

(setq inferior-lisp-program "/usr/local/bin/sbcl") (add-to-list 'load-path "/Applications/slime") (require 'slime) (slime-setup)

Vim, Ctags, Emacs, Slime, Steel Bank Common Lisp.

You should also install Emacs Invoke Emacs and with the command M-x slime go into Lisp interaction mode. Useful REPL commands are Control-c Control-p to move back one prompt, Control-c Control-n to move forward, Control-a and Control-e to go to beginning and end of the line, Control-x o to switch between buffers, Control-C Control-D d to lookup documentation for a symbol, and Control-X Control-S to exit emacs.

For LISP documentation online see

I've also used CLISP and XLISP.


  1. Mac or Windows On either Mac OS X or Windows, install Java from Oracle Java Downloads
  2. Mac Install Netbeans for Mac OS X
  3. Windows After installing Java, click on the downloaded executable file jdk-NuN-nb-N_N_N-win-ml.exe to install the Java SDK. This includes the Java runtime environment as well as the compiler (javac), interpreter (java), debugger (jdb), applet viewer (appletviewer). The SDK is installed into C:\Program Files\Java\jdkN.N.N_NN/bin and the NetBeans IDE is installed into C:\Program Files\netbeans-N.N.N. It will appear as an icon on the desktop.

    In Settings->System->Advanced->Environment Variables, under System Variables, edit the path to include ...;C:\Program Files\Java\jdkN.N.N_NN\bin;...

    Now open a DOS or Cygwin command window and test run the Java compiler, interpreter, and debugger javac -version, java -version, and jdb -version. You should get back version number N.N.N_NN

  4. Now that you're set up, begin programming by reading the introductory Java language tutorial Java Tutorial. For the GUI, read Java Swing Tutorial, and for reference the Java API.


I was programming in Perl and switched over to Python after discovering this article.


The first language I learned was FORTRAN

Berkeley Computing Center Punched card circa 1975.

It now has object oriented programming!

$ cat circle.f90 module class_Circle implicit none private real :: pi = 3.1415926535897931d0 ! Class-wide private constant type, public :: Circle real :: radius contains procedure :: area => circle_area procedure :: print => circle_print end type Circle contains function circle_area(this) result(area) class(Circle), intent(in) :: this real :: area area = pi * this%radius**2 end function circle_area subroutine circle_print(this) class(Circle), intent(in) :: this real :: area area = this%area() ! Call the type-bound function print *, 'Circle: r = ', this%radius, ' area = ', area end subroutine circle_print end module class_Circle program circle_test use class_Circle implicit none type(Circle) :: c ! Declare a variable of type Circle. c = Circle(1.5) ! Use the implicit constructor, radius = 1.5. call c%print ! Call the type-bound subroutine end program circle_test $ gfortran circle.f90 -o circle ./circle Circle: r = 1.50000000 area = 7.06858349


Octave is a free MATLAB clone. On Macs you need to install gnuplot. Download the gnuplot source and unpack it into a directory. Run ./configure --with-readline=builtin, then run make and finally sudo make install.

Wise words from, In a nutshell, this is a problem with OSX itself. Apple chose to ship Leopard with an emulated libreadline package. But the emulation is incomplete, and programs that link against it expecting a "real" libreadline fail with erros like the ones you quote. I suggest complaining to Apple. They should hear from their users that their choice of libraries was not good. Meanwhile, your options are either (1) delete the broken libreadline that shipped with Leopard and replace it with the real gnu libreadline (2) tell gnuplot not to use libreadline at all ./configure --with-readline=builtin

Run from /Applications. It comes up in a terminal window. In the window, cd to your working directory containing your MATLAB .m files. Type the name of your MATLAB function or type the name of the .m file if you have just an inline main program. Plots will pop up in a separate window using the X11 windowing system.


To view Mathematica files download the free math player

Insert Mathematica CD-ROM. Install all onto hard disk. Type in password. Custom install all components into D:/Program Files/Wolfram Research. Create shortcut on desktop to C:\Program Files\Wolfram Research\Mathematica\4.0 Remember SHIFT-ENTER evaluates expressions.


VIM Programmer's Editor

Download gvim from Vim. I compile from source for my MacBookPro. Also install the Vim Tutorial Book, vimbook-OPL.pdf in the same directory under subdirectory /Notes. Don't forget the Vim User Manual, FAQ and download instructions.

To do file differences, load the first file, ignore whitespace with :diffopt=iwhite, then do :diffsplit <second file name> :diffupdate will resync if needed. Put my customized file .vimrc and also FunctionHeaderTemplate.txt etc into C:/Program Files/vim or ~ (Unix home directory). Here is my .vimrc

"============================================================================= " " NAME " " .vimrc " " DESCRIPTION " " Settings for Vim editor loaded upon startup in MS Windows. " " NOTES " " UNIX, Mac OS X: Copy to ~/.vimrc " Windows: Copy to C:/Program Files/vim/_vimrc " " AUTHOR " " Bram Moolenaar <> " Sean E. O'Connor 14 Dec 2007 " "============================================================================= " " Use Vim settings, rather then Vi settings (much better!). " This must be first, because it changes other options as a side effect. set nocompatible " Don't know what this is. source $VIMRUNTIME/vimrc_example.vim " Turn on MS Windows behavior. source $VIMRUNTIME/mswin.vim " Mouse and window behavior tuned for Microslime Windows. behave mswin " When started as "evim", evim.vim will already have done these settings. if v:progname =~? "evim" finish endif " Allow backspacing over everything in insert mode. set backspace=indent,eol,start set backup " Keep a backup file suffixed with ~ after editing. set history=500 " Keep 500 lines of command line history. set ruler " Show the cursor position all the time. set showcmd " Display incomplete commands. set incsearch " Do incremental searching. set hlsearch " Searches are highlighted. set lines=45 " Number of lines visible on the screen. set columns=80 " Number of columns visible on the screen. winpos 400 45 " Initial window position (MacBookPro). set winwidth=140 " Initial window width. set winminwidth=140 " set smartindent " Use smart indenting. set shiftwidth=4 " Indent 4 spaces. set tabstop=4 " Tabs are 4 spaces wide. set expandtab " Expand tabs into spaces. set showmatch " Show matching parentheses. set matchtime=5 " Match time is 1/2 sec. " Set file paths to my most commonly used directories (MacBookPro). set path="~/Applications/vim/**" set path+="~/Desktop/Sean/WebSite/**" " Error blink and bell. set errorbells set visualbell " Default directory is my current active subdirectory " in my web page directory. " This is where :e . takes us. cd ~/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/SourceCode " Set paths for tags files generated by Exuberant ctags (I renamed it xtags)" set tags=./tags,tags,../tags,../../tags,../../../tags,~/Desktop/Sean/WebSite/Mathematics/AbstractAlgebra/PrimitivePolynomials/Project/SourceCode/tags " Add new syntax highlighting for certain keywords. Classify them as type xType syntax keyword xType uint syntax keyword xType uint32 syntax keyword xType UInt32 syntax keyword xType SInt32 syntax keyword xType UInt16 syntax keyword xType SInt16 syntax keyword xType UInt8 syntax keyword xType SInt8 syntax keyword xType BigInt " Color them the same as the C group-name "Type". highlight link xType Type " =============================================================================== " | Use the Torte color scheme for the full gVim GUI but " | default for launching vim from a command window. " =============================================================================== if has("gui_running") " Use the Torte color scheme when we run vim in GUI mode. " Otherwise if launched from the terminal, use the default colors. colorscheme torte if has("gui_gtk2") set guifont=Courier\ New\ 11 elseif has("gui_kde") echoerr "Sorry, please look into your kvim documentation" elseif has("x11") set guifont=-*-courier-medium-r-normal-*-*-180-*-*-m-*-* elseif has("gui_win32") set guifont=Courier_New:h13:b "set guifont=Lucida_Console:h13:cDEFAULT elseif has("gui_mac") "set guifont=* else "set guifont=* endif endif " Abbreviations. :iabbrev theo <em>Theorem.</em> :iabbrev cor <em>Corollary.</em> :iabbrev lem <em>Lemma.</em> :iabbrev pf <em>Proof.</em> :iabbrev qed $\blacksquare$ " ============================================================================== " | " | Useful vim macros " | " | ,sou Read new user settings. " | ,w Save the file. " | ,tbe Trim blanks at the end of every line. " | ,para Surround text with an html paragraph. " | ,t Toggle comment line. " | ,cc Convert single line C to C++ comment. " | " ============================================================================== " Reload this VIM resource file. map ,sou :source $HOME/.vimrc<CR> " Save the file. map ,sa :w<CR> " Trim blanks at end of all lines. map ,tbe :%s/\s*$//<CR> " Make p in Visual mode replace the selected text with the "" register. vnoremap p <Esc>:let current_reg = @"<CR>gvs<C-R>=current_reg<CR><Esc> " Switch syntax highlighting on, when the terminal has colors. " Also switch on highlighting the last used search pattern. if &t_Co > 2 || has("gui_running") syntax on set hlsearch endif " Toggle comment lines. You can highlight the range " with the mouse and then do ,t function! ToggleComment() " Get the line under the cursor " Check if it begins with | if getline(".") =~ '^|' let s:savedSearchPat=@/ s/^|// let @/=s:savedSearchPat else let s:savedSearchPat=@/ s/^/|/ let @/=s:savedSearchPat endif endfunction map ,t :call ToggleComment()<CR> function! InsertRobotCoordinates() " First set the starting coordinates in the editor using " :let g:xpos = 1 " :let g:ypos = 1 " Check the values " :echo g:xpos " :echo g:ypos " Get the current line under the cursor. let s:currentLine = getline(".") " Find the next occurance of the pattern Frame at the beginning of the line and move to the end of pattern " match. execute "normal /^F.*OutOfRange/e+1\<CR>" " Does the line begin with the word Frame? if s:currentLine =~ '^F.*OutOfRange' " Increment the position in integer units. let g:xpos += 100 let g:ypos += 200 " Write out the mm coordinates. let s:coordinates=printf("Robot (%2.2f %2.2f)mm", g:xpos/100.0, g:ypos/100.0) " Append the coordinate after the line. put = s:coordinates "let s:newLine=s:currentLine."\n".s:coordinates " Replace the line with the modified version. "call setline( ".", s:newLine ) endif endfunction " Short hand command ,r to insert the coordinates. map ,r :call InsertRobotCoordinates()<CR> " Convert C comments on a line to C++ comments. function! ConvertCCommentToCpp() " Get the line under the cursor " Check if contains a /* if getline(".") =~ '\/\*' let s:savedSearchPat=@/ s/\/\*/\/\// let @/=s:savedSearchPat endif if getline(".") =~ '\*\/' let s:savedSearchPat=@/ s/\*\/// let @/=s:savedSearchPat endif endfunction map ,cc :call ConvertCCommentToCpp()<CR> " Justify a paragraph. map ,j gqap " Only do this part when compiled with support for autocommands. if has("autocmd") " Enable file type detection. " Use the default filetype settings, so that mail gets 'tw' set to 72, " 'cindent' is on in C files, etc. " Also load indent files, to automatically do language-dependent indenting. filetype plugin indent on " For all text files set 'textwidth' to 78 characters. autocmd FileType text setlocal textwidth=78 " When editing a file, always jump to the last known cursor position. " Don't do it when the position is invalid or when inside an event handler " (happens when dropping a file on gvim). autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif endif " has("autocmd") set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif if &sh =~ '\<cmd' silent execute '!""C:\Program Files\Vim\vim71\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"' else silent execute '!C:\Program" Files\Vim\vim71\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 endif endfunction

Lisp Files

When you right click on a file name with a .lsp extension, you should see Vim in the Open With list. If you can't see it, run regedit, go to HKEY_CURRENT_USER/Software/Microsoft/Windows/CurrentVersion/Explorer/FileExts/ .lsp/OpenWithList. You'll see Names a, b, c, d, etc. Change one of them or add a new one with (for example) Name=b, Type=REG_SZ and Data=gvim.exe. Make sure Name=MRUList with Type=REG_SZ has Data=c in its list.

If you can't get gvim to open a *.lsp file in explorer when you click on the file name, run regedit, go to HKEY_CURRENT_USER/Software/Classes/Applications/gvim.exe create subdirectories /shell/open/command in command, let the name=(Default), Type=REG_SZ and the Data= "C:\Program Files\vim\vim71\gvim.exe" "%1" Now you should be able to associate *.lsp files with gvim.exe HKEY_CLASSES_ROOT/.lsp has Name=(Default), Type=REG_SZ, Data=Vim.Application.

C, C++ and CTags

Edit C:/Program Files/vim71/syntax/c.vim and add the keyword uint to the list of keywords beginning with int.

You should also install Exuberant ctags to make your programming life easier. Follow instructions on how to compile the source on Mac OS X. You may need to edit the makefile to set the C compiler and its compile and link flags properly. To use it, let's say your C++ source code is in /Sean/Project/SourceCode. Go up one directory and generate a tags file,

cd /Sean/Project
ctags -R

In VIM, do :set tags=./tags,tags,/Sean/Project/tags. Now, when you edit a C++ file in VIM, go to a function name and do Ctrl-] to zap to the definition of the function and Ctrl-T to get back. If there are duplicates, use :ts, e.g. :ts operator = shows a list of possibilities to pick.

C++ operators will cause trouble, so edit the tags file to eliminate spaces using :1,$s/operator /operator/g to convert tags such as "operator +=" to "operator+=" for example. Also set the flag at the top of the ctags file to indicate UNSORTED, i.e. don't use binary search. To jump, highlight operator+= with the mouse, then hit Ctrl-], or use :tag operator+=. If there is ambiguity, use the command :ts operator+= and select the tag you wish to jump to.

Perl Files

To properly syntax-color Perl files with the *.prl file name extension, edit C:/Program Files/vim71/syntax/perl.vim and add *.prl to the lines below:

" Perl
if has("fname_case")
  au BufNewFile,BufRead *.pl,*.PL,*.prl call FTCheck_pl()
  au BufNewFile,BufRead *.pl,*.prl call FTCheck_pl()

GIMP Paint Program

Similar to Paintshop Pro and Adobe Photoshop with paint tools and layers, but free, GIMP runs on both Windows, Mac, and Linux download it and its documentation from Gimp


A 3D rendering and animation tool, free from Blender org


Not free, but a useful editor for drawing diagrams, OmniGraffle

Open Office Suite

Free office suite software set with spreadsheets, presentation software, word processing, and drawing from Open Office.

Ghostscript Postscript Viewer

Install the Ghostscript interpreter following the instructions from Ghostscript.


For Mac OS X, install from MacTex TeX User's Group, and be sure to read this excellent tutorial


Netzero ISP

I used connect to the internet through the dialup telephone line using Netzero but now I use AT&T Uverse.



Zip File Compression Software Windows

Install PKZIP from PKWare or use Gzip

Firefox Browser

Download the Firefox browser.


Chenard Chess Program Windows

Window and Linux executables and source code is available for the chess engine Chenard

Arasan, Winboard Program Windows

Install Winboard which is a chess GUI. Install the Arasan chess engine, arsanx.exe. Start up Winboard, then select "Use an Internet Chess Server", type in " /icsport=5000 /icshelper=timeseal", check "Additional options" and type in, -ics -zp -autoflag -fcp "C:\Games\ArasanChess\arasanx.exe -ics -H 8000" For KKF chess playing atomic, type in -ics -zp -autoflag -fcp "C:\Games\KKFChess\kkf.exe /variant atomic -ics"


Stellarium is a free planetarium program.

Red Pill Screen Saver

Get the source code from GitHub,

$ clone

Build in XCode. Let XCode update your garbage collection and nib files. Double click on RedPill.saver to load it

Copyright © 1999-2017 by Sean Erik O'Connor. All Rights Reserved.     last updated 01 Jan 17.