CS 1: Fall 2014

CS1 Mac Installation

This page shows you how to install the CS 1 software on your Mac. You will install all of the following:

If you encounter any trouble installing the software, make sure to come to the "Install-Fest," 7:00 pm to 10:00 pm on Wedensday, March 26th and Thursday March 27th in LSC 200.

Install Python 2.7

You'll first need to download and install Python. There are different versions; which one you should use depends on your version of MacOS X. You can check your MacOS X version number by choosing the About This Mac menu item from the Apple menu at the upper left corner of your screen. You will see three numbers. For example, mine says Version 10.8.4. The first number will be 10, and the last number doesn't matter. The middle number is the important one, and it will probably be 5, 6, 7, 8, or 9 indicating OS X 10.5, 10.6, 10.7, 10.8, or 10.9 respectively.

Then click on one of the links below to download the Python installation package:

If you get a .dmg file, drag it to your Desktop and double-click it. You will see an icon for Python 2.7.2. If it doesn't open automatically, double-click on Python 2.7.2. You should see something like this:

Double click on the Python.mpkg icon to start the Python installer:

Click through this entire installer. At some point it will probably ask you for your password to install; enter your password and continue.

Note for Mac OS 10.7 and higher users: When you try to open Python.mkpg, you might see a message reading "Python.mpkg can't be opened because it is from an unidentified developer. Your security preferences allow installation of only apps from the Mac App Store and identified developers." If you see this message, you have two choices for working around it. First, either control-click the file or right-click it, and then select Open. You'll see a message reading "Python.mpkg is from an unidentified developer. Are you sure you want to open it?" Click Open. Your second choice is to change your security settings. To do so, go to System Preferences and select Security and Privacy under the Personal section. Unlock the lock in the bottom left corner by clicking on it and entering your password. Then, under Allow applications downloaded from:, click the Anywhere radio button.

You will soon get to a "success" screen like this:

If you do not get to the "success" screen, first double-check that you downloaded the right installer for your operating system: the 10.3 installer won't work, for example, with 10.7. If things still aren't working, ask someone on the course staff for help.

If everything is OK so far, drag the .dmg file to the Trash.

Install Java

Do this step only if you are running OS X 10.9 (Maverick). If you are running OS X 10.6-10.8, then skip this step.

If you are running OS X 10.9 (Maverick) you may need to update to Java 7. First, determine which version of Java you are running by opening the "Terminal" and typing "java -version". If the first line of the output reports "java version 1.7.XXX" (where XXX doesn't matter), then you are running Java 7 and can skip this step. If you don't see 1.7 in the version number, then follow the directions below.

Download Java 7 by clicking here. Accept the license agreement at the top of this page and then download the file highlighed in red below (Mac OS X x64). Open the downloaded file, double click on the installer named JDK 7 Update 51.pkg and follow the installation instructions.

Install Eclipse

Eclipse is the name of the software program you will use to type in your Python programs and run them. Download the appropriate version:

click the green arrow to download

The download might take a few minutes.

If you're asked what to do with the file, choose to open it with Archive Utility. Otherwise, By default, the file will go into your Downloads folder; find it there, and extract it by double-clicking on the downloaded file. A folder labeled eclipse should appear. Once you see the eclipse folder, drag this folder to the Applications folder on your hard drive. To do so, open another Finder window. You should see Applications among the folder choices in the pane on the left side. Click on Applications, and then drag the eclipse folder into the Applications folder.

Open the eclipse folder. Because you'll be running Eclipse often, you will probably want to add it to the dock by dragging the Eclipse icon to your dock.

Run Eclipse, either by clicking on the Eclipse icon in the dock (if you put it here) or by double-clicking on the Eclipse icon in the eclipse folder. Since this is your first time running Eclipse, the following dialog box will pop up:

Your account name will appear instead of thc. Check the box that says Use this as the default and do not ask again, and click OK.

Note for Mac OS 10.7 and higher users: Upon opening Eclipse for the first time, you might get a dialogue box reading "To open 'Eclipse' you need a Java SE 6 runtime. Would you like to install one now?" Click Install to start the installation.

Once Eclipse finishes loading, you will see the following screen:

Click the icon that says Workbench in the top right. You will never see this screen again. Now you'll see this window:

Install PyDev

The PyDev add-on for Eclipse can be downloaded within Eclipse. While running Eclipse, go to the menu bar, select Help and then Install New Software.... The following dialog box should pop up:

Click Add... in the top right.

In this dialog box, under Name, type PyDev. Under Location, type http://pydev.org/updates

Click OK on this dialog box. Once Eclipse loads the software list, make sure that PyDev has a check next to it, and then click Next:

You'll see this window:

Click Next. Read and agree to the Eclipse license, and then click Finish.

While Pydev is installing, the following dialog box may pop up. Check the box next to Brainwy Software; PyDev; Brainwy and click OK:

When Pydev has finished installing, click Yes to restart Eclipse.

Configure Eclipse and check your installation

Next, you will configure Eclipse and check that you have installed Eclipse and PyDev correctly. Click on the circled icon next to Java in the top right:

You'll see this window:

Click on PyDev and then click OK.

Under the File menu, select New and then PyDev Project. This window will appear:

Type in a project name. I used cs1proj, but you can use whatever project name you like.

Then click on Please configure an interpreter in the related preferences before proceeding. Select Manual Config. You'll see this window:

Click New. You'll see this window:

Next to Interpreter Name, type Python. Next to Interpreter Executable, type /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7. (In both of the preceding sentences, that last period ends the sentence; don't type it in.) Your window should look like this:

Click OK. You'll see this window:

Click Select All, then click OK, and click OK again. Finally, click Finish.

From now on, whenever you create a new PyDev project, where it says Interpreter, you can just leave it at the choice you see, Default.

Download the file pyversion.py. If you just click on this link, you'll see the code for the file in your browser window. To download it, either control-click or right-click the link and then choose Save Link As .... For convenience, move this file from your Downloads folder to your Desktop. Then drag the pyversion.py icon from the Desktop to where it says cs1proj (or whatever project name you chose) in the PyDev Package Explorer tab of your Eclipse window. The triangle next to cs1proj will point downward, and you'll see what's now in your cs1proj:

Single-click on pyversion.py. Then, from the Run menu, select Run As and then 1 Python Run:

If all went well, you'll see this:

At the bottom of the window, you'll have a Console tab, and it should read something like

2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

At this point, you have a working version of Eclipse that will enable you to run Python programs. But you cannot yet run programs with graphics, so we'll set that up next.

Install the graphics software

The course staff has written a collection of Python functions that will let you easily draw graphics with your Python programs.

Important note: This software works only with Mac OS 10.6 through 10.9. If you are running Mac OS 10.5 or earlier, you will not be able to use the graphics software on your computer. You should either upgrade to Mac OS 10.6 or higher, or do all assignments that require graphics on one of the Macs in 002 Sudikoff.

First, you will install a package called Qt. To download it, click here. If asked, you can accept the default application to open the file being downloaded. You should see a disk icon named QT 4.7.4. If it doesn't open automatically, double-click on it. You'll see this window:

Double-click on Qt.mkpg to start installing Qt. Click Continue, Agree, and Install when you have the choice. You'll be asked for your password in order to install Qt.

Next, you'll install PySide. To download it, click here. If the Installer doesn't automatically open, find pyside-1.1.0-qt47-py27apple.pkg in your Downloads folder, and double-click on it. Click on Continue and Install. When the installation is done, drag the .pkg file that you just downloaded to the Trash.

Now download cs1lib.py. You will be accessing this file a lot, so I suggest putting it in an easily accessed place, such as your Desktop. Drag cs1lib.py onto cs1proj in the PyDev Package Explorer tab of Eclipse:

Next, download eyes.py. Drag eyes.py from wherever you downloaded it to onto cs1proj in the PyDev Package Explorer tab of Eclipse:

Single-click on eyes.py. Then, from the Run menu, select Run As and then 1 Python Run. You should get a window like this one:

If you see this window, you are done! Yay!

A note: You might also see some red text in the Console tab, with some indecipherable but ominous message looking something like this

objc[38975]: Object 0x7fcfaab65a80 of class NSConcreteMapTable autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug

You'll see this message whenever you use the CS 1 graphics package. Foreboding though it appears to be, it is harmless. Don't worry about it.