mkdir -p $DUCKAPP/Contents/Frameworks
cp release/$DUCKLIB $DUCKAPP/Contents/Frameworks/$DUCKLIB
install_name_tool -id @executable_path/../Frameworks/$DUCKLIB $DUCKAPP/Contents/Frameworks/$DUCKLIB
install_name_tool -change $DUCKLIB @executable_path/../Frameworks/$DUCKLIB $DUCKAPP/Contents/MacOS/DuckCapture
The main approach is to use the tool "install_name_tool" for dylib, and you'd better to pay more attention to path. It's easy to make mistakes on path in this script.
In addition for releasing, there is another issue for debugging applications with xcode. You can open a console, and run commands below:
You'll get some clues when dylib is missing.