LDFLAGS="\$$LDFLAGS -Wl,-rpath,/usr/local/cuda/lib"
to the mex command did the trick for me. Reference: https://devtalk.nvidia.com/default/topic/418143/dyld-library-not-loaded-rpath-libcudart-dylib-/
Hope this helps!
-Jay..build_release/tools/caffe
dyld: Library not loaded: @rpath/libcudart.7.0.dylib
Referenced from: /Users/deepsamal/Desktop/Research/caffe/.build_release/tools/caffe
Reason: image not found
make: *** [runtest] Trace/BPT trap: 5
But I think the problem I am having is not in mex command but in runtest. I also made sure that libcudart.7.0.dylib is indeed in /usr/local/cuda/lib and this path is part of DYLD_FALLBACK_LIBRARY_PATH.
Any help appreciated.
Mac OS 10.9, Cuda 7.0