-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for macOS #615
base: main
Are you sure you want to change the base?
Conversation
…op doesnt support bind-propagation
Trying this branch on my M1 MacBook Air using colima results in:
Using it with docker-desktop, it seems that the distrobox is not created when distrobox-create exits. I view the logs of the container and it continues installing packages and such for some time. I'm not sure if that is normal. But if I let that run to what appears to be completion (ie I see "container_setup_done" in the container logs), then I get the following:
|
Are you running with the experimental virtio and rosetta 2 support? I think those are gonna be key in getting io and cpu performant enough to make this viable, without them my |
Not sure about lima :( |
I just enabled virtio and rosetta2 support but the behavior was the same for me. |
hmm weird, just reset my settings and tried creating the fedora toolbox image and it works great for me. it does take a couple minutes to start up so i had to run |
--volume \"${distrobox_export_path}\":/usr/bin/distrobox-export:ro | ||
--volume \"${distrobox_hostexec_path}\":/usr/bin/distrobox-host-exec:ro | ||
--volume \"${container_user_home}\":\"${container_user_home}\":rslave" | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--volume \"${distrobox_entrypoint_path}\":/usr/bin/entrypoint:ro
--volume \"${distrobox_export_path}\":/usr/bin/distrobox-export:ro
--volume \"${distrobox_hostexec_path}\":/usr/bin/distrobox-host-exec:ro
is the same for both cases, so maybe you can move them to line 468?
else | ||
install $@ | ||
fi | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POSIX install
should work why specifically use gnu install?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the -D
flag isn’t present in macOS’s install
.
https://apple.stackexchange.com/questions/201029/install-illegal-option-d
I’m not familiar with which flags are required by POSIX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Luckily, we can just add coreutils
as a build dependency. It would easier to make brew install distrobox
the main way to install distrobox
on macOS. There's already a forumla at distrobox.rb.
It only needs slight modifications (removing depends_on :linux
and adding coreutils
as a dependency for macOS). I have the installer working on my Intel-based macOS just via brew install coreutils
and then adding the GNU commands earlier in my PATH
. Here is why:
~ $ install -D
install: illegal option -- D
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 file2
install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
[-o owner] file1 ... fileN directory
install -d [-v] [-g group] [-m mode] [-o owner] directory ...
~ $ /usr/local/opt/coreutils/libexec/gnubin/install -D
ginstall: missing file operand
Try 'ginstall --help' for more information.
It is easier to implement to use ginstall
directly, though:
~ $ ginstall -D
ginstall: missing file operand
Try 'ginstall --help' for more information.
~ $
I'm currently working on getting brew install distrobox
to fully work out of the box on Linux (Homebrew/homebrew-core#135178). This should hopefully aid in porting basic features to macOS (Homebrew/discussions#4603).
The way I currently simulate distrobox enter
on macOS is very bare-bones and depends on manually creating and renaming the containers. I can learn from the way distrobox create
does it and write my own scripts, but porting distrobox
to macOS would benefit more people.
#!/usr/bin/env bash
# Usage: my-distrobox-enter <name>
#
# Note: You kinda have to create the container first
# 1. podman run -it homebrew/brew
# 2. open -a "Podman Desktop" # Find the name
# 3. podman rename suspicious_wozniak brew
# Debugging
set -ex
# Start the podman machine (VM) if needed
podman machine start || true
# Start the container if needed
podman start "$1"
# Profit
podman exec -it "$1" bash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure why my replies are marked “Pending” and they seem not visible
Edit: I figured it out thx to https://github.com/orgs/community/discussions/10369
@@ -82,6 +82,14 @@ | |||
icon_dest_path="${prefix}/share/icons" | |||
completion_dest_path="${prefix}/share/bash-completion/completions/" | |||
|
|||
install_command() { | |||
if [ "$(uname)" == "Darwin" ]; then | |||
ginstall $@ |
Check failure
Code scanning / shellcheck
Double quote array expansions to avoid re-splitting elements.
if [ "$(uname)" == "Darwin" ]; then | ||
ginstall $@ | ||
else | ||
install $@ |
Check failure
Code scanning / shellcheck
Double quote array expansions to avoid re-splitting elements.
--volume \"${distrobox_export_path}\":/usr/bin/distrobox-export:ro | ||
--volume \"${distrobox_hostexec_path}\":/usr/bin/distrobox-host-exec:ro | ||
--volume \"${container_user_home}\":\"${container_user_home}\":rslave" | ||
if [ "$(uname)" == "Darwin" ]; then |
Check warning
Code scanning / shellcheck
In POSIX sh, == in place of = is undefined.
@@ -82,6 +82,14 @@ | |||
icon_dest_path="${prefix}/share/icons" | |||
completion_dest_path="${prefix}/share/bash-completion/completions/" | |||
|
|||
install_command() { | |||
if [ "$(uname)" == "Darwin" ]; then |
Check warning
Code scanning / shellcheck
In POSIX sh, == in place of = is undefined.
Hi @kevindurb glad to see work is being done on this! 😄 Hopefully I can find some mac where to test this stuff 👀 I've left a couple of comments, and some linting stuff to do, will try to also create a macos VM where to test all of this |
@89luca89 Would you be able to work off of an x86 2017 MacBook Air? I might be able to acquire one from work and ship it to you. If not, I'd be happy to test on any of my Macs; I have access to x86 and arm64 Apple laptops and one x86 mini. I'd even be willing to setup a GitHub Actions runner to do the same if it's possible to test in CI. Would love to see this get spearheaded for testing ephemeral Mac instances the same way I do with Linux 🙌 |
Thanks for the offer but I'd prefer not to accept, that would be too much :) But if anyone knows If there are any services online that can (legally) give you access to a remote Macos VM (where I can also run lima and docker-desktop) that can help |
No worries! Looks like you've got HostMyApple (HMA), MacInCloud (MIC), and MacStadium. Latter is the most spendy for bare metal at $119/mo; they don't advertise the virtualized instance prices. Former two are both $25/mo. HMA is a VM, MIC is bare metal. If you setup a GitHub Sponsorship, can chip in for any of the above. |
Will take a look at them thanks a lot! :) |
85306b9
to
8b31dc4
Compare
Hi, I see that this was built with Docker Desktop in mind. However, Podman is supported on MacOS as well, and I was wondering if you have been able to test this with Podman. I am trying to spin up a MacOS VM to test this but I don't exactly have convenient access to a Mac either! |
I don't see a reference to ginstall in Brew. What's that package? |
@FedX-sudo |
Highly recommend podman desktop backend for this on macOS, just saying... https://podman-desktop.io/downloads |
a1c5095
to
2061ce7
Compare
615a4b5
to
c8ed679
Compare
Just stumbled across this PR. I have an Intel-based MacBook Pro. Is there anything I can help with? |
Running
Trying to enter that distrobox then yields:
Should this branch be rebased against |
Is there a reason this PR was drafted? I'd love to help port distrobox to macOS |
Could you check out this branch and try it out locally, in so we can improve on the remaining issues together? I would be interested in seeing how far you get in trying to get it to work. There's this |
I’d be interested in collaborating on a PR, if there’s interest in officially maintaining it! It’s up to @89luca89 (and other maintainers) if it’s worth the effort. Feel free to @ me if this PR re-opens or there’s another open PR. Also, I think small bite-sized incremental support is better than one big PR. Like, one only for the install (and maybe some clarifying documentation that it’s in beta, we can also add a caveat to the brew formula). |
6c315c5
to
88e2b5a
Compare
I would be interested in helping as well. |
Having this issue: ❯ distrobox create --image fedora |
@redthing1 looks like you got pretty far to be honest, it would be interesting to see:
output there. If you manually copy in a distrobox-export to /usr/local/bin/distrobox-export ... You might get further? |
By the way Fedora Asahi Remix aka Asahi Linux: https://asahilinux.org/2023/08/fedora-asahi-remix/ works out the box for distrobox, if you want to install Linux on your Apple Silicon system and run distrobox that way. |
I think the problem relies on how distrobox mounts some of its own stuff into the container, so probably one needs to I'm not sure after that how much integration would work having a VM as middleman And at that point, you may as well use a regular podman/docker container |
Yeah, I'm currently working on a minimalist implementation of this that provides a more abstracted/automated CLI for macOS. If anyone else is interested, let me know and I'll share it |
ba8e5e7
to
0c4615b
Compare
456475a
to
d065c94
Compare
cca3514
to
551675e
Compare
c14e010
to
a7df145
Compare
This gets the installer working on macos systems, you still need to
brew install coreutils
so we might want to add that to the README.mdThis also changes mounting of volumes for macos only to skip
/, /dev, /tmp, /sys
and changes the user home mount to be a "regular" shared mount rather than rslave