Skip to content

Instantly share code, notes, and snippets.

@masukomi
Created April 13, 2018 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masukomi/be48ef9f801c3632f15210c3066c50fc to your computer and use it in GitHub Desktop.
Save masukomi/be48ef9f801c3632f15210c3066c50fc to your computer and use it in GitHub Desktop.
#!/bin/sh
[insert command to compile your app here]
# copy all the optional ones
rm -rf dylibs/*
# REPLACE path/to/my/new/binary below with the path to your newly compiled binary
DYLIBS=`otool -L path/to/my/new/binary | grep "/opt" | awk -F' ' '{ print $1 }'`
for dylib in $DYLIBS
do
echo "- copying $dylib"
base=$(basename $dylib)
cp $dylib dylibs/
# if you can figure out a way to use the 3 magic variables to provide you with a predicatable path
# then you can use install_name_tool
# REPLACE path/to/my/new/binary below with the path to your newly compiled binary
# install_name_tool -change $dylib "/some/known/path/on/target/computer/$(basename $dylib)" path/to/my/new/binary
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment