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 , but nothing is working.

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

#include <cuda.h>

global void add(int a, int b, int *c ) {
int main() {
int a,b,c;
int *dev_c;
int size = sizeof(int);
cudaMalloc(&dev_c, size );
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:

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.