clang -dynamiclib -o libtest.dylib file1.o file2.o -L/some/library/path -lname_of_library_without_lib_prefix
some article:
other compile case:
in ros install on Mac :
Create symbolic links such that the system knows where to find the packages(this step is necessary because we need to let the system know where the libs are located.)
$ cd ros_catkin_ws/install_isolated/lib #navigate to the dir containing all the libs
$ for n in *.dylib; do ln -s P W D / PWD/ PWD/n /usr/local/lib/$n; done