How to use vtool to change LC_VERSION_MIN_MACOSX to LC_BUILD_VERSION?

I've discovered that some of my third party intel dylibs are using the old LC_VERSION_MIN_MACOSX, which I'm pretty sure are causing library loading problems. My reasoning is that the arm versions all use the new format and works. The intel version works without signing and notarisation, but not when signed and notarised.

See: https://developer.apple.com/forums/thread/127450 "The LC_VERSION family of load commands are no longer emitted when targeting the latest versions of the operating systems. Those commands are superseded by LC_BUILD_VERSION." https://developer.apple.com/forums/thread/659964

Just wondering what the incantation is to change from the old to the new so that:

myThirdPartyPlugin.dylib: Load command 8    cmd LC_VERSION_MIN_MACOSX  cmdsize 16  version 10.7    sdk 10.15.4

becomes something like: myThirdPartyPlugin.dylib: Load command 8    cmd LC_BUILD_VERSION  cmdsize 32  platform MACOS   minos 12.0    sdk 12.3   ntools 1    tool LD  version 820.1

Thanks in advance for your time and response.

Stew

Replies

OK, I figured it out.

For example:

vtool -set-build-version macos 12.0 12.0 -replace -output "/Volumes/Data/Projects/MyApp/Pharo/Builds/1.0.0/Bundle/intel64/MyApp.app/Contents/MacOS/PluginsFixed/libUnixOSProcessPlugin.dylib" "/Volumes/Data/Projects/MyApp/Pharo/Builds/1.0.0/Bundle/intel64/MyApp.app/Contents/MacOS/Plugins/libUnixOSProcessPlugin.dylib"

Unfortunately, I'm getting an error:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/vtool error: mkstemp: No such file or directory

I've created the output directory and confirmed I have the right path for the input file.

I suspect this is a command line tools configuration problem when creating a temp file, and will create a new post.

`vtool -help
usage: vtool [-arch <arch>] ... <show_command> <file>
    vtool [-arch <arch>] ... <set_command> ... [-replace] [-output <output>] <file>
    vtool [-arch <arch>] ... <remove_command> ... [-output <output>] <file>
    vtool -help
 show_command is exactly one of:
  -show
  -show-build
  -show-source
  -show-space
 set_command is one or more of:
  -set-build-version <platform> <minos> <sdk> [-tool <tool> <version>] ...
  -set-build-tool <platform> <tool> <version>
  -set-version-min <platform> <minos> <sdk>
  -set-source-version <version>
 remove_command is one or more of:
  -remove-build-version <platform>
  -remove-build-tool <platform> <tool>
  -remove-source-version
 platform is one of:
  macos
  ios
  watchos
  tvos
  bridgeos
  maccatalyst
  uikitformac
  iossim
  watchossim
  driverkit
 tool is one of:
  clang
  swift
  ld
 platform and tool can also be specified by number



`

FYI - please see https://developer.apple.com/forums//thread/726440?answerId=747919022#747919022 for the solution to the mkstemp error problem.