Open Bug 2063096 Opened 3 months ago Updated 2 months ago

[macOS 27] `./mach run --debug` doesn't work on macOS 27

Categories

(Firefox Build System :: Mach Core, defect, P2)

defect

Tracking

(Not tracked)

People

(Reporter: smichaud, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: Workarounds in comments #8 and #9)

User Story

As a workaround, add the -a command line option: `./mach run -a --debug`.

See comments #8 and #9 for workaround details.

After building current trunk code on macOS 27, ./mach run --debug doesn't work properly. The command itself does work -- it loads Firefox into lldb. But entering run at the lldb prompt results in the following error, which prevents Firefox from running:

Profile Missing
Your Firefox profile cannot be loaded. It may be missing or inaccessible.

./mach run works just fine, and uses the same profile directory (obj-aarch64-apple-darwin27.0.0/tmp/profile-default). So presumably this is some kind of access-denied error that happens only inside lldb.

Various errors appear in the console when you try to use run in lldb. But, as best I can tell, they're all irrelevant. They also happen using ./mach run --debug, then run, on macOS 26.6.1 (Apple Silicon), where run works just fine.

Giving /usr/bin/lldb "full disk access" (in the Privacy & Security system settings panel) doesn't work around this bug, even after rebooting.

Here's a workaround that does work:

Disable SIP on your boot partition by running csrutil disable from the Recovery partition.

Whiteboard: Workaround in comment #2

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Mach Core' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Mach Core

I've been testing on macOS 27 Beta 5 (build 26A5406e). This is currently the most recent beta.

See Also: → 2060476

I've discovered that even ./mach run doesn't work unless you give Terminal "Full Disk Access" in Privacy & Security.

I've also discovered a better workaround for ./mach run --debug than disabling SIP:

  1. Give Terminal "Full Disk Access".
  2. Enter settings set target.inherit-tcc true at the lldb prompt.

I suspect we'll just have to include instructions for giving Terminal "Full Disk Access" in the documentation for ./mach run and ./mach run --debug. But ./mach run --debug already sets target.arg0, target.exec-search-paths and target.run-args. So it shouldn't be hard to also make it set target.inherit-tcc to true.

I don't really know why this works.

Whiteboard: Workaround in comment #2 → Workaround in comment #5

(In reply to Steven Michaud [:smichaud] (Retired) from comment #5)

I've also discovered a better workaround for ./mach run --debug than disabling SIP:

  1. Give Terminal "Full Disk Access".
  2. Enter settings set target.inherit-tcc true at the lldb prompt.

Good to know!

I don't really know why this works.

Since, by default, lldb launches applications without "inheriting" the TCC chain of the executable, then when you launch a local build of Firefox in lldb that is not signed with a team ID associated with ~/Library/Application Support/Firefox, the access should be denied.

Once you set target.inherit-tcc to true, the TCC chain passes down to Terminal which has full disk access and is allowed to access ~/Library/Application Support/Firefox regardless.

Thanks, Haik. Your explanation for target.inherit-tcc makes sense.

I'm going to put off trying to find a fix for this bug. It's a tricky problem trying to decide how best to give Terminal full disk access, or its equivalent. I'd just as soon let others handle it. In the meantime, my workaround from comment #5 is simple and straightforward, with this modification:

Put the following text into ~/.lldbinit:

# Partial workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=2063096
settings set target.inherit-tcc true

I tested with this and had no problems.

Whiteboard: Workaround in comment #5 → Workaround in comment #5 and comment #7

Here's yet another, better workaround for this bug:

  1. Grant access to "Firefox" in System Settings → Privacy & Security → Files & Folders → Terminal
  2. Put the following into ~/.lldbinit:
# Partial workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=2063096
settings set target.inherit-tcc true
Whiteboard: Workaround in comment #5 and comment #7 → Workaround in comment #8

Yet another workaround. Pass the -a or --appdata argument to ./mach run so that mach will set the MOZ_APP_DATA environment variable causing Firefox to use a directory in the object dir instead of ~/Library/Application Support/Firefox.

./mach run -a --debug
User Story: (updated)
Whiteboard: Workaround in comment #8 → Workarounds in comments #8 and #9
User Story: (updated)
Depends on: 2068208
Severity: -- → S4
Priority: -- → P2
You need to log in before you can comment on or make changes to this bug.