How to Sign and Notarize Command Line Tools?

Because of business requirements, we need to develop a command-line tool on macOS. According to Apple's policy, we need to sign and notarize it before distribution. My steps are as follows:

  1. Sign the executable
  2. Compress the executable file into a zip package
  3. Submit the zip to notarization and succeed
  4. Unzip the zip and execute it on another mac, and report an error: the dynamic library cannot be loaded

How should I solve it?

How to Sign and Notarize Command Line Tools?
 
 
Q