Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code signature workaround for dylibs on macOS 11.0 (Apple Silicon)
$ brew reinstall gettext
[…]
$ gettext --version
Killed: 9
$ replace_inode() {
local filename
for filename; do
chmod o+w "${filename}"
rm -f "${filename}.bak"
mv -f "${filename}" "${filename}.bak"
cp "${filename}.bak" "${filename}"
rm -f "${filename}.bak"
done
}
$ export -f replace_inode
$ find /usr/local/opt/gettext/lib -type f -name '*.dylib' -print0 \
| xargs -r0 bash -c 'replace_inode "$@" && codesign -s - -f "$@"' _
/usr/local/opt/gettext/lib/libgettextpo.0.dylib: replacing existing signature
/usr/local/opt/gettext/lib/libtextstyle.0.dylib: replacing existing signature
/usr/local/opt/gettext/lib/libintl.8.dylib: replacing existing signature
/usr/local/opt/gettext/lib/libasprintf.0.dylib: replacing existing signature
/usr/local/opt/gettext/lib/libgettextsrc-0.21.dylib: replacing existing signature
/usr/local/opt/gettext/lib/libgettextlib-0.21.dylib: replacing existing signature
$ gettext --version
gettext (GNU gettext-runtime) 0.21
Copyright (C) 1995-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.
@iains

This comment has been minimized.

Copy link

@iains iains commented Oct 28, 2020

[on the basis that the issue is to do with flushing of information from the buffer cache] is it sufficient to change the inode (without regenerating the code signature)?

@claui

This comment has been minimized.

Copy link
Owner Author

@claui claui commented Oct 28, 2020

@iains YMMV but when I last tested, I had to regenerate the code signature no matter what.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment