Loading libcudart.dylib

Hello All,

I have issued “make” command and the deviceQuery example was compiled successfully, Or at least I didn’t see any error.

But when I try to run it by issuing ./deviceQuery

I receive this error

dyld: Library not loaded: @rpath/libcudart.dylib
Referenced from: /Developer/CUDA/bin/darwin/release/./deviceQuery
Reason: image not found
Trace/BPT trap

What should I do? any help is appreciated.


By the way I have a MackBook pro and a Newbie to both mac and CUDA

Add these lines to your .bash_profile:

export PATH=/usr/local/cuda/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH

Thanks, It solved the problem.


Hmm, I don’t have the file “.bash_profile” on my MBP running 10.5.5.

What am I missing?


After a little investigation I discovered it is a hidden file. Still didn’t have it so I created it.

It works now.



I have this error when I run it as root. When I add the export DYLD_LIBRARY_PATH command it works for root and my graphics card is recognized. Under the regular user account (even with the .bash_profile modifications), I get the Device Emulation mode for the graphics card. I changed a bunch of priviledges with no succes so far.

Any suggestions?

are you exporting it as root or as a normal user?

When I do it as root (and use sudo -s) it works. When I do it as regular (or put it in .bash_profile) it doesn’t.

Try installing the toolkit again. Make sure you click “Customize” and select the “kext” thingy. It’s unselected by default … and its description is … “It allows you to run CUDA”

That worked. Still confused as to why root worked.


Is there any way to handle this without messing with the . bash_profile? If my program doesn’t run from the command-line, that file is meaningless, and there are also cases when you don’t want to mess with the user profile.