Pedro P. Irazoqui 6/30/2015
Python installation on Mac OS X:
1. Install Xquartz First you’ll need to install a UNIX windows manager. Mac OS X is a UNIX-based operating system running a window manager called Aqua by default. Installing XQuartz will allow you to really take advantage of your machine and open up a world of free (e.g. Gimp for photoshop-like image processing; Octave for a free implementation of Matlab; and countless others) and paid software (e.g. Matlab for scientific computing; Cadence for microchip design, simulation, and layout; and many others). Download the XQuartz installer from here: http://xquartz.macosforge.org/landing/
Follow the instructions, and drag the XQuartz icon onto your dock. You’ll be using it a lot!
As an engineer you should really know your way around a UNIX terminal. You can get there in an afternoon by going through this tutorial once you’ve installed XQuartz: http://linuxcommand.org/learning_the_shell.php
After you do that, you’ll want to configure both your xterm environment and your shell to work best with python. My own xinitrc and bashrc files are located in the same directory as this document. They’re a good place to start, and you can modify from there. When they’re ready, you should put them in your home directory and prefix them with a “.” so you’ll have a .xinitrc and .bashrc files. Once you do this, you’ll no longer see them if you type “ls” at the prompt. Use “ls -a” instead.
Finally, you’ll want to settle on a text editor to write your programs. I think most people use emacs, but old-school guys like me use vi. Both are already installed on your Mac, and you can start them by typing $ emacs or $ vi at the terminal prompt. Note that the prompt here is assumed to be “$”, don’t type that, just type the part after the “$”. If you’ve used my .bashrc file above, your prompt will end in “>>”. vi is definitely a little cryptic at first, but I think it’s well worth it if you get the hang of it. That’s up to you though. If you decide you want to learn vi, go through this quick tutorial: http://www.unix-manuals.com/tutorials/vi/vi-in-10-1.html
2. vi configuration (optional) First you’ll want to install Python-mode for vi. Note: vim is a newer version of vi, when you type vi at the prompt, you’re actually running vim. Essentially vim has replaced vi, and the two terms are used interchangeably with most everyone using vim and calling it vi. The easiest way to install Python-mode is to use pathogen. At the prompt, type: $ mkdir -p ~/.vim/autoload ~/.vim/bundle $ curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim $ cd ~/.vim/bundle $ git clone git://github.com/klen/python-mode.git