title: How to inject code into an arm64e process in macOS?
body: <p>I've written <a href="https://github.com/briankendall/forceFullDesktopBar" rel="nofollow noreferrer">a utility</a> that modifies system behavior by injecting compiled code (in the form of a dylib) into the Dock using the old <a href="https://github.com/rentzsch/mach_inject" rel="nofollow noreferrer"><code>mach_inject</code></a> method. However, <code>mach_inject</code> hasn't been updated in several years now and doesn't work on Apple Silicon macs.</p>
  <p>Is there another method I can use to inject and execute code from a dylib into arm64e processes? <code>mach_inject</code> creates a thread in the target process and executes the payload in that thread, so I'd need it to do something similar.</p>
  <p>I've been pointed to <a href="https://frida.re" rel="nofollow noreferrer">frida</a> as a possible alternative but it seems to be catered towards interacting with a target process through a javascript runtime, rather than injecting already compiled code into a process. I haven't been able to figure out if it can do what I need.</p>