Installing CUDA on mac os 10.6.8

i have a problem installing CUDA on a mac book pro, os x 10.6.8, with nVidia GeForce 9400M and 9600M GT.

I tried installing CUDA 5.0 at first (i did not read it was not supported by mac os 10.6), and then CUDA 4.0 from https://developer.nvidia.com/cuda-toolkit-40 , but nothing is working.

I compiled and run this code several times with several different problems,

#include <cuda.h>
#include

global void add(int a, int b, int *c ) {
*c=a+b;
}
int main() {
int a,b,c;
int *dev_c;
int size = sizeof(int);
cudaMalloc(&dev_c, size );
a=2;
b=7;
add<<<1,1>>>(a,b, dev_c);
cudaMemcpy( &c, dev_c, size, cudaMemcpyDeviceToHost );
cudaFree( dev_c );
std::cout << a << " + " << b << " = " << c <<"
";
return 0;
}
and the best result i achieved is:
2+7=0

Can anyone help me? Thanks.

I don’t know why, but i installed again CUDA 5.0 and exported these paths:

echo “export PATH=/Developer/NVIDIA/CUDA-5.0/bin/:$PATH” >> ~/.bash_profile
echo “export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH” >> ~/.bash_profile

and now everything is working.