Skip to content

Add macos support#96

Closed
ovo-Tim wants to merge 27 commits into
Gerharddc:mainfrom
ovo-Tim:macos-support
Closed

Add macos support#96
ovo-Tim wants to merge 27 commits into
Gerharddc:mainfrom
ovo-Tim:macos-support

Conversation

@ovo-Tim

@ovo-Tim ovo-Tim commented May 4, 2026

Copy link
Copy Markdown

#95
Adds macOS host support by gating Linux-only features and dependencies behind cfg(target_os = "linux").

Changes

  • Make Landlock optional on non-Linux (no-op on macOS) and move landlock dependency to Linux-only target deps.
  • Gate Linux-only nix usage (prctl, inotify, major/minor) and add non-Linux-safe behavior where needed.
  • Refactor devices.rs into clean platform-specific implementations; non-Linux now returns a clear unsupported error for device attachment.
  • Update README to document macOS support and clarify Linux-only features (Landlock, litterbox device).

Do not merge for now. The test is still going.

@ovo-Tim

ovo-Tim commented May 4, 2026

Copy link
Copy Markdown
Author
image It's good to go now

@Gerharddc Gerharddc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! As indicated in my comments, I would prefer if this change be much smaller and not have so much platform-conditional code. I believe that is possible by approaching things differently.

Comment thread litterbox/scripts/litterbox-helper.sh Outdated
Comment thread litterbox/src/settings.rs Outdated
Comment thread litterbox/src/commands/entrypoint.rs
Comment thread litterbox/src/devices.rs
Comment thread litterbox/src/commands/entrypoint.rs Outdated
Comment thread litterbox/src/devices.rs Outdated
@Gerharddc

Copy link
Copy Markdown
Owner

Please rebase this on #101 and check how well it works on macOS. This change should make support much easier because now there is a dedicated "lbx-init" binary which goes inside the container and can easily be cross-compiled

@ovo-Tim

ovo-Tim commented May 6, 2026

Copy link
Copy Markdown
Author
image Good to go again 🎉

@Gerharddc

Copy link
Copy Markdown
Owner

Sorry for the delay, but great to see the Linux lbx-init binary now works on MacOS! I've now merged my large PR after making a few more tweaks. Unfortunately it seems you will now have to rebase again after those changes, sorry about that

@ovo-Tim ovo-Tim force-pushed the macos-support branch 2 times, most recently from 44d084e to b1e5c9f Compare May 14, 2026 00:25

@Gerharddc Gerharddc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the hard work on this! And my apologies for being pedantic, but I prefer to keep PRs clean and concise. I prefer when a PR has one specific goal and does not touch other parts of the code along the way

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes required for macOS support?

Comment thread litterbox/src/settings.rs
Comment thread .github/workflows/make-release.yml
Comment thread ARCHITECTURE.md
Comment thread litterbox/src/env.rs Outdated
Comment thread litterbox/src/podman.rs Outdated
Comment thread litterbox/src/podman.rs
Comment thread litterbox/src/podman.rs Outdated
Comment thread litterbox/src/podman.rs Outdated
Comment thread litterbox/src/podman.rs Outdated
Comment thread lbx-init/src/commands/entrypoint.rs Outdated
Comment on lines +50 to +46
let _ = symlink("/lbx-init", format!("/usr/bin/{su_bin}"));
let _ = symlink("/litterbox", format!("/usr/bin/{su_bin}"));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not look right, are you sure this works?

Comment on lines -16 to -17
use shared::entrypoint::{CommonEntrypointOptions, WaitBehaviour};
use shared::env;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also seems odd

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this file has been changed by accident. It believe it should not need to be changed at all

@ovo-Tim

ovo-Tim commented May 16, 2026

Copy link
Copy Markdown
Author

Really sorry for all the mess. I'm a bit overloaded this week.

I'm testing the code after reverting all the "unnecessary" changes as you required. But I constantly get:

❯ cargo run --manifest-path ./litterbox/Cargo.toml -- enter test1
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `litterbox/target/debug/litterbox enter test1`
[2026-05-16T02:46:18Z DEBUG litterbox::commands::enter] Container "08a5b29ce3b08037551a95f08889213a26f1fc296ca3787ea6206dcac01eb471" is already running; just attaching...
[2026-05-16T02:46:18Z DEBUG litterbox::commands::enter] Entering Litterbox...
[2026-05-16T02:46:18Z DEBUG lbx_init::commands::entrypoint] XDG_RUNTIME_DIR: /run/user/501
Error: Failed to set owner of $XDG_RUNTIME_DIR

Caused by:
    ENOENT: No such file or directory
[2026-05-16T02:46:18Z DEBUG litterbox::commands::enter] Exited Litterbox

After inspecting the code carefully, I found that we are using /run/user/{uid} as XDG_RUNTIME_DIR, but it will only be created when the wayland or pipewire working path is mounted.

@ovo-Tim

ovo-Tim commented May 16, 2026

Copy link
Copy Markdown
Author

Sometimes I get this error while rebuilding:

Error: statfs /Users/tim/Litterbox/.session-test2.lock: no such file or directory
Error: Podman command failed

It seems to occur randomly. I failed to find the cause.

@Gerharddc

Copy link
Copy Markdown
Owner

@ovo-Tim I appreciate all the work you have done on this, but after seeing how the solution is working out and the shortcomings involved, I just don't think macOS support makes sense anymore. I sincerely apologise that it has taken me so long to reach this conclusion.

Given that neither graphics nor the ssh agent work on macOS, I really don't see the point of using Litterbox on macOS over just using Podman directly. The little bit of convenience Litterbox may add can easily be replicated with a simpler program (likely even just some shell script). There is also not much portability for Litterbox users between Linux and macOS since most of the features will be missing.

Hence, the minimal reward does not justify the additional maintenance burden of trying to support macOS. I think it will also be misleading to users to pretend that there is really support for macOS.

I believe that making Litterbox truly cross platform will require re-implementing it from scratch to use microVMs instead of simple Linux containers. I'm not working on this now, but it is something that I'm considering in the distant future (should I ever find time for it).

For now however, if you really want to use Litterbox on macOS, I would suggest using it inside a full blown Linux VM so that you can take advantage of the features it offers. Alternatively, just use Podman directly. Or feel free to maintain a fork, that's totally cool too :)

@Gerharddc Gerharddc closed this May 16, 2026
@Gerharddc Gerharddc mentioned this pull request May 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants