Software setup for Macintosh

This document describes the procedure to set up your Apple Mac OS X computer for Java development and for submitting the course assignments using git.

Install Git

Git is a distributed version control tool used by many software developers. In this course, you will use it to submit your work. Using git, I can distribute recommended changes back to you, and my server will keep track of all versions of your work that it ever sees.

Git can be difficult to master, but I will provide recipes for the common cases we will encounter, and there is an interface for Git in IntelliJ, our development environment.

To get started, visit this link: http://git-scm.com/download/mac and allow it to download the Git 1.8 installer.

Downloading git

Downloading git

Git disk image in Downloads

Git disk image in Downloads

Open the downloaded disk image, and you’ll see a package installer. Double-click it to open.

Git installer icon in the disk image

Git installer icon in the disk image

Proceed through the installation; there really aren’t any decisions to make, but you’ll have to type your account password.

Git setup step 1

Git setup step 1

Git setup step 2

Git setup step 2

Allow git to make changes

Allow git to make changes

Git setup complete

Git setup complete

After installation, you can eject the disk image using the Finder

After installation, you can eject the disk image using the Finder

Configure SSH

SSH is the secure shell program for connecting to remote servers. Git uses it to upload your assignments. We need a bit of configuration for this to work.

In the finder, go to the Applications » Utilities folder, and open the Terminal application.

Terminal icon

Terminal icon

Terminal window

Terminal window

At the terminal prompt ($), type the following command and press enter:

    ssh-keygen

It should produce output like the following. You will have to press enter three more times: once to use the default file name, and twice to enter an empty passphrase. Your fingerprint and ID will differ from mine, of course.

Output of ssh-keygen

Output of ssh-keygen

Next, you need to create a configuration file for accessing my server. Enter these two commands at the bash prompt:

    touch .ssh/config
    open -e .ssh/config

In the text editor that pops up, type the following, on two separate lines:

host liucs.net
port 1010

Save the file (File menu » Save or ⌘-S) and close the editor.

Finally, type the following command at the bash prompt:

    open -e .ssh/id_rsa.pub

The editor window will contain ssh-rsa followed by a long code. This is your public key. Select all (⌘-A), then copy (⌘-C), and paste the content into an email message to . Also include your full name in the email message.

You may now close the editor and the terminal window.

Install IntelliJ

We will use the JetBrains IntelliJ IDEA as an integrated development environment for Java – both in this course and in the Android project course. Download the free community edition here: http://www.jetbrains.com/idea/download/ You can get the latest version (12), although the screens here refer to version 11.

IntelliJ download page

IntelliJ download page

IntelliJ disk image in Downloads

IntelliJ disk image in Downloads

Open the downloaded disk image, and you’ll see a window like the following. Drag the IntelliJ icon into the Applications folder.

IntelliJ installation

IntelliJ installation

After installation, you can eject the disk image

After installation, you can eject the disk image

Configure IntelliJ

Start the IntelliJ IDEA from the Applications folder. You’ll have to agree to open the app, since it was recently downloaded.

Confirm that it’s okay to open the app

Confirm that it’s okay to open the app

It may ask if you want to import previous settings, just accept the default.

IntelliJ import settings

IntelliJ import settings

IntelliJ splash screen

IntelliJ splash screen

Eventually, you will see the initial screen, with some choices for getting started.

IntelliJ initial screen

IntelliJ initial screen

First, we need to do some configuration. Select the Configure » Project Defaults » Project Structure. In the Project SDK section, click the New button and select JDK.

IntelliJ project structure

IntelliJ project structure

You’ll see a file chooser, in which you must navigate to System » Library » Java » JavaVirtualMachines » version.jdk. Note: If you cannot find any version.jdk file on your system, let me know right away, and tell me what version of Mac OS you are running.

Location of JDK

Location of JDK

Once that is selected, click OK on the chooser. The Project SDK should now show a version number, and you can click OK again to apply the settings.

IntelliJ project SDK configured

IntelliJ project SDK configured

The other bit of configuration is to tell IntelliJ about git. Choose ‘Preferences’ from the IntelliJ IDEA application menu.

IntelliJ application menu

IntelliJ application menu

Within that dialog, look for Template Project Settings (the first section) » Version Control » Git.

IntelliJ git preferences

IntelliJ git preferences

The executable path should be set to /usr/local/git/bin/git (with no spaces, and all lower-case letters). It’s fine to leave the SSH executable as built-in, but also enable the auto-update option. The ‘Test’ button should report that it found the right version of git.

Git executed successfully

Git executed successfully

Click OK to dismiss the git test, and also to apply the new settings.

Congratulations! Your machine is fully configured for Java development and assignment submission.