Arduino Sketch Crashes as Soon as Processing Sketch Starts

I've recently been experimenting with 3-axis accelerometers/gyroscopes and I've been trying to implement the FreeIMU motion tracking cube in Processing, however every time I try to start the Processing sketch, the Arduino sketch crashes first and stops writing the necessary data to the Serial port. On its own, the Arduino sketch works exactly as it should and writes the appropriate data to the designated port at 9600 Baud. But then I start up the Processing sketch and the Arduino sketch stops working. All the Processing sketch reads is null, and I've double checked to make sure it's reading from the same Serial port that the Arduino is writing to. And as a side note, if I try to start up the Arduino sketch again while the Processing sketch is still running, it raises an error: "processing.app.SerialException: Serial port '/dev/tty.usbmodemfd121' already in use. Try quitting any programs that may be using it." Is there some reason as to why I can't have both of these programs working on the same port? Is there a known issue like this? Any help would be appreciated, thanks.

The processing sketch probably opens the serial port thereby resetting the Arduino.
You should start the processing first,
wait for a signal that the Arduino is ready to go
and then go

robtillaart:
The processing sketch probably opens the serial port thereby resetting the Arduino.
You should start the processing first,
wait for a signal that the Arduino is ready to go
and then go

I tried that but then Processing tells me that it couldn't open the port because the port couldn't be found. For some reason, it only realizes the port is open when the Arduino is connected to it. I also just found out there may be some issues with Serial communication for users of OS X Lion and later, which I am.

[EDIT] Just realized the Baud rate of the Processing sketch wasn't the same as the Arduino's and that's why there was miscommunication. However the Processing sketch still isn't performing what it should be...

JackSac67:
only realizes the port is open when the Arduino is connected to it

That is normal.
The program on the Arduino will start as soon as the USB connection is made - but you just need to ignore this.

When Processing (or any other PC program) opens the serial port the Arduino will restart. Your Processing sketch must wait for this to happen. A good technique is to have the Arduino send a message from setup() (e.g. Serial.println("Ready"); and the Processing program should wait until it receives that before doing anything else.

...R