Skip to content

Instantly share code, notes, and snippets.

@claui
Created October 28, 2020 08:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save claui/d362138193358f28dca9a540b714a0b9 to your computer and use it in GitHub Desktop.
Save claui/d362138193358f28dca9a540b714a0b9 to your computer and use it in GitHub Desktop.
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
Copy link

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
Copy link
Author

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