
Hello. Welcome to the first tutorial all about getting setup to start coding in Objective C and Objective J.
If you don’t have them already, you are going to need to download and install:
Ok here we go. I’m assuming you have run the installers for xCode 3 and Git for your particular build of Mac OS X.
This is required to install Cappuccino 0.7 beta. You can read about it here and here. To install it, open up a Terminal window and run the following command:
sudo gem install plist
You’ll have to enter your password and some information will be displayed. If you are on a slow G4 like me, this could take a few minutes.
Now we need to take a copy of the Cappuccino code on GitHub. We will keep it within the /usr/local/ folder. Run the following commands in Terminal:
sudo mkdir /usr/local/src
cd /usr/local/src/
sudo git clone git://github.com/280north/cappuccino.git
The commands above create our src (source) folder, move into it and then use Git to get a snapshot of Cappuccino. You may have to enter your password. Your Terminal window will look something like this after the final command:

Now we need to move into the cappuccino folder containing all the code. Run the following command:
cd cappuccino
In Git you have to set the active code branch you are working with. At this stage we will be dealing with the master but we need to switch to 0.7b. Run the following command:
sudo git checkout -b 0.7b origin/0.7b
You’ll be told you just switched to the 0.7b branch

If you really get to grips with Git, to see what branches are available you could run the following command:
git show-branch –all
In the future you will want to see what branches are available. You can read the Git manual here.
So we have the latest snapshot from Git. Now we just need to build it. Run the following command:
sudo rake release
Your terminal window will look something like below. Again on a slow G4 like mine, this will take some time. Put the kettle on. If you have a fast Mac get someone to put it on for you.

Once your Mac has finished crunching away you will most likely see the warning below:

We need to get a copy of ojunit (a unit testing tool) from the 280 North Git repository. I’m getting into unit testing thanks to a friend of mine and might do some tutorials on it at some point.
Run the following commands:
cd Tools
git clone git://github.com/280north/ojunit.git
cd ..
You just moved into the Tools directory, used Git to pull down the code for ojunit and then moved back into the parent cappuccino folder. Your Terminal window will look similar to below:

You can now, once again run the command:
sudo rake release
Things should have turned out lovely, similar to below:
You are doing great, if you didn’t get someone to put the kettle on for you before, do so now.
Before we install the freshly built Cappuccino code we are going to have to setup an environment variable. If you are not familar with pico then you are about to see what a text editor looks like in a UNIX command line environment. It’s not as bad as it sounds and I’ll break this part down in case it’s new to you.
In UNIX-ish systems you can create a text file with some instructions to be carried out when you login or turn on your computer. We are going to create a file in your Home folder that will setup an important reference to where Cappuccino should be installed on your system. Later on you will see how this reference allows a tool called capp to create a basic Cappuccino application. Let’s create the file by typing the following command:
pico ~/.profile
You have just told pico (a command line text editor) to open up a text file called .profile within your home folder. The ~ is shorthand for /Users/YOUR_HOME_FOLDER_NAME)
Your Terminal window will look something like below:

At this point it is useful to remember that your mouse is not much help in a command line text editor, so don’t scroll up or down while using pico.
To setup the reference to where Cappuccino will be installed, type the following into pico:
export PATH=$PATH:/usr/local/bin
Your Terminal window running pico window will look similar to below:

You now need to save the changes you made to your .profile file. On your keyboard hold control and press the letter o key. This is the WriteOut command you will see listed at the bottom of the pico winow which makes pico ‘writeout’ the contents of the file to disk. If you got it right you will see pico telling you about the ‘File Name to Write:’ like below:

You can just hit the enter or return key on your keyboard to save the changes. You’ll see pico will tell you that it wrote one line like below:

You can now exit pico by holding the control key and pressing the letter x key. You will return to the by now familiar looking command line.
Almost done. To finally install Cappuccino into /usr/local/bin run the following commands:
cd /usr/local/bin/
sudo rake install
Your Terminal window will output some text as it crunches away similar to below:

On a slow G4 Mac like mine…. Well, I’m on my third cup even if you aren’t.
When Cappuccino is installed you will have a Terminal window similar to below:
We’re all set to make our very first Cappuccino application. Run the following commands in Terminal:
cd ~/Desktop
capp myFirstApp -t NibApplication
Your Terminal window will show capp crunching away like below:

You just moved to your Desktop folder and used the capp aplication to generate a Cappuccino application named myFirstApp based on the NibApplication template. You can read more about capp, it’s options and templates here.
You can close Terminal now and return to the Finder. On your Desktop you will see a folder called myFirstApp. Here’s a general overview of what’s inside:

AppController.j – Your starting point for your app which holds the important method applicationDidFinishLaunching. It’s in here where you will eventually write your Objective J
Go ahead and open index.html in your browser and you will see your first basic Cappuccino application up and running:

Hope you found that useful. Please leave any comments or questions below and I will get back to you eventually.
Cheers,
Matt