MatthewPierson / Ramiel

An open-source, multipurpose macOS GUI utility for checkm8-vulnerable iOS/iPadOS devices
GNU General Public License v3.0
172 stars 27 forks source link

[Bug] The Homebrew binary isn't always in /opt/homebrew/bin on macOS 11 #4

Closed TheLukeGuy closed 3 years ago

TheLukeGuy commented 3 years ago

Describe the bug Currently, you determine the path of the Homebrew binary with this code:

NSString *brewPath;
if (@available(macOS 11.0, *)) {
    brewPath = @"/opt/homebrew/bin/brew";
} else {
    brewPath = @"/usr/local/bin/brew";
}

However, the Homebrew binary is only in /opt/homebrew/bin on ARM machines. On x86 machines running macOS 11, the binary is still in /usr/local/bin. This makes it impossible to use Ramiel on x86 machines that run macOS 11.

To Reproduce Steps to reproduce the behavior:

  1. Install Homebrew and Ramiel on an x86 machine running macOS 11
  2. Open Ramiel and let it try to install its dependencies
  3. Observe how Ramiel instructs you to install Homebrew even though it's already installed

Expected behavior Ramiel should check if it's being run on an ARM machine to determine the Homebrew binary path rather than checking if it's being run on macOS 11.

Screenshots Proof that the issue is present

Desktop (please complete the following information):

Additional context I am using a QEMU/KVM virtual machine to try Ramiel (I'm not sure whether or not it works in a VM but I'm trying it anyway), however everything should be nearly identical to a physical Mac.

MatthewPierson commented 3 years ago

Hi, could you please try this build of Ramiel and let me know if it changes anything? I decided to check sysctl for whether or not Ramiel is running as translated or not (on macOS 11.x only) to decide what Brews path should be.

TheLukeGuy commented 3 years ago

Alright I tried the new build and there's a different error this time:

image

The "detailed" log is here:

Device Information:

Model: (null)
iOS Version: (null)
Bootargs: "-v"

Other Error Information:

sysctl returned -1 when we expected 1 or 0.
Failed to get proc_translated info from sysctl!

Detailed Error Log:

0
MatthewPierson commented 3 years ago

Ok, so it seems that the fix works, since sysctl puts 0 into ret, but for some reason the sysctlbyname function is returning -1. I think i'll just remove the check for sysctlbyname's return value since it seems to work fine.

Will get a new build notarised and will send again just to make sure it works :)

MatthewPierson commented 3 years ago

Alright have uploaded a new build, please give it a try @ConsoleLogLuke! Heres the link

TheLukeGuy commented 3 years ago

Works great, thanks for the quick fix! Nice job with Ramiel in general btw, it seems like a really well-made tool.

Sort of a related question: Is there any reason for you to install dependencies through Homebrew as opposed to compiling the libraries alongside Ramiel and linking them? Homebrew can be pretty slow and having to install libraries system-wide for an application doesn't really seem to be that ideal. I guess compile time and download size could be reasons for using Homebrew for it, but the libraries you use don't seem to be large enough to make that too much of an issue.

MatthewPierson commented 3 years ago

Thats great, thanks!

The only reason I need Brew at all is to get iproxy via libimobiledevice, I already bundle the required dylibs with Ramiel but until I sit down and get a bundled iproxy binary to use the included libimobildevice dylib this is the solution. Will likely sort it out in the next week or so :)

TheLukeGuy commented 3 years ago

Oh that makes sense, sounds good!