This scripts packs executables and dynamic libraries into a Mac OS application bundle.
It's conforms to the rules defined in Apple TechNote 2206 and was derived from this discussion.
How to use:
-
Copy your files into the
/Contents/Resources
directory of your app. Create nested directories if you like. This script will process them correctly. -
Run
pwsh Symlink-App.ps1 /path/to/my.app
. This script:- Finds all executables and copies them into
Contents/MacOS
. - Finds all
.dylib
files and copies them intoContents/Frameworks
. - Leaves a dynamic link from each original file location in
/Contents/Resources
to its new location.
- Finds all executables and copies them into
pwsh
is Powershell, and can be installed with brew install powershell
. I first
tried to implement this script in zsh
, but my application has a space in its name,
and simple things like ${path:t:e}
failed to parse the file extension.