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:

• Python 2.7
• Eclipse IDE
• The CS 1 library, including graphics software

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.

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:

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 need to update to Java 7. 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:

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.

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.

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.

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:

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