Skip to content

feat: add macOS support to quickstart scripts#220

Open
agullon wants to merge 3 commits into
mainfrom
macos-quickstart
Open

feat: add macOS support to quickstart scripts#220
agullon wants to merge 3 commits into
mainfrom
macos-quickstart

Conversation

@agullon
Copy link
Copy Markdown
Contributor

@agullon agullon commented May 13, 2026

Adds macOS support to quickstart.sh and quickclean.sh. The same scripts now work on both Linux and macOS.

On macOS, the scripts require a rootful podman machine:

brew install podman
podman machine init --memory 4096
podman machine set --rootful
podman machine start
curl -s https://microshift-io.github.io/microshift/quickstart.sh | sudo bash

Changes:

  • quickstart.sh: detect macOS, validate rootful podman machine, run LVM setup inside the VM via podman machine ssh
  • quickclean.sh: detect macOS, clean up LVM inside the VM via podman machine ssh
  • Container name is now configurable: ./src/quickstart.sh [name]

Note: macOS CI coverage is not possible because GitHub Actions macOS runners do not support virtualization. podman machine start requires Apple's Virtualization Framework (vfkit), which is blocked on GitHub-hosted runners. The macOS code path is tested manually.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Scripts now accept an optional container name argument for customization.
    • Extended macOS support with platform-specific initialization and cleanup operations.
    • Improved installation guidance including Homebrew options for missing tools.
  • Documentation

    • Updated OS support notes for clarity and formatting consistency.

Review Change Stack

@agullon agullon requested a review from a team as a code owner May 13, 2026 13:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

Warning

Rate limit exceeded

@agullon has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 36 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4519327f-f64f-4369-9308-b5ce11f1c90b

📥 Commits

Reviewing files that changed from the base of the PR and between f0108ff and 4eb81b2.

📒 Files selected for processing (3)
  • README.md
  • src/quickclean.sh
  • src/quickstart.sh
📝 Walkthrough

Walkthrough

Both setup and cleanup scripts now support a configurable container name argument (defaulting to microshift-okd) and branch on OS type: Darwin uses podman machine ssh for remote LVM setup inside the Podman VM, while Linux retains existing local cleanup and initialization. Platform-specific validation and prerequisite handling are restructured accordingly.

Changes

Cross-platform container configuration

Layer / File(s) Summary
Container name parameterization
src/quickstart.sh, src/quickclean.sh
Both scripts accept an optional first argument to set CONTAINER_NAME, defaulting to microshift-okd, replacing all hard-coded container references.
Cross-platform cleanup refactoring
src/quickclean.sh
Cleanup branches on OS: Darwin SSHes into the Podman machine for remote LVM/disk removal; Linux runs microshift-cleanup-data, removes LVM config, uninstalls RPMs, and clears the LVM disk/loop device.
Platform-specific initialization and LVM setup
src/quickstart.sh
prepare_lvm_disk branches on Darwin (remote initialization via podman machine ssh with conditional sudo user handling) vs. other platforms (existing local disk and loop device setup); Darwin validates Podman connectivity and enforces rootful mode; Linux enforces root execution; OpenVSwitch loading skips Darwin; prerequisite messaging adds Homebrew fallback.
Container runtime operations and output
src/quickstart.sh, README.md
All podman run/exec/stop operations, failure handling, and post-start instructions reference the configured CONTAINER_NAME; README formatting adjusted for consistency.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • microshift-io/microshift#137: Adds initial container/image conditional cleanup and RPM/data removal paths to src/quickclean.sh, which this PR extends with cross-platform Darwin branching via podman machine ssh and configurable container naming.

Suggested reviewers

  • ggiguash
  • pacevedom
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add macOS support to quickstart scripts' clearly and concisely describes the primary change—extending the quickstart scripts to support macOS in addition to Linux.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch macos-quickstart

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@agullon agullon force-pushed the macos-quickstart branch 4 times, most recently from 750c382 to e1d0c51 Compare May 13, 2026 14:03
Comment thread src/quickstart.sh Outdated
Comment thread src/quickstart.sh Outdated
Comment thread src/quickstart.sh Outdated
Comment thread src/quickstart.sh Outdated
@ggiguash
Copy link
Copy Markdown
Contributor

@agullon , can we please also address the following issues in this PR?

  • Update top-level README with a mention of MacOS
  • Not directly related to your changes: 2 isolated-network tests do not seem to be defined properly - probably needs removal (can do in a separate PR, or open an issue if you prefer)

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/quickstart.sh (2)

9-9: 💤 Low value

Heads up: CONTAINER_NAME consumes $1 under set -u.

With set -u, the ${1:-microshift-okd} default is safe — but note any later shift-based arg parsing would now be off by one. Currently no other positional args, so it's fine as-is. Just leaving a breadcrumb for future args.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/quickstart.sh` at line 9, CONTAINER_NAME is assigned from positional $1
while the script uses set -u which will treat unset positional parameters as
errors and any later use of shift would misalign args; to fix, either avoid
consuming $1 directly by using a named option parsing or preserve positional
parameters (e.g., parse args with getopts or copy $@ to another array) and
update any shift logic accordingly, or explicitly document and guard
CONTAINER_NAME assignment so future shift-based parsing isn’t off-by-one; refer
to the CONTAINER_NAME assignment and any subsequent shift or positional parsing
logic to implement one of these approaches.

63-85: 💤 Low value

Darwin reuse path doesn't early-return like the Linux branch.

On Linux (lines 87-91), when lvm_disk exists you zero it and return 0 immediately. On Darwin, after zeroing you fall through to the vgs check and may re-run losetup/vgcreate. Since dd of 100MB likely wipes the LVM header, vgs returns non-zero and a fresh vgcreate runs — which is arguably the correct behavior for a "clear and reuse" cycle. Worth deciding whether Linux should match macOS (also recreate VG after zeroing) or vice versa, otherwise reuse semantics diverge subtly between platforms.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/quickstart.sh` around lines 63 - 85, The Darwin branch's heredoc handling
of lvm_disk differs from Linux: after zeroing the existing lvm_disk with dd the
Linux branch returns immediately (return 0) but the Darwin branch continues to
run vgs/losetup/vgcreate, causing divergent reuse semantics; pick one behavior
and make both branches consistent—either (A) match Linux by causing the Darwin
heredoc to exit early after the dd (so the remote ssh block stops and the script
returns 0) or (B) match Darwin by removing the immediate return in the Linux
branch so both platforms proceed to vgs/losetup/vgcreate after zeroing; update
the code around lvm_disk handling (the dd/truncate logic) and the flow control
(return/exit) so lvm_disk and vg_name reuse is identical across platforms.
src/quickclean.sh (1)

10-13: ⚡ Quick win

Root enforcement is inconsistent with quickstart.sh on macOS.

quickstart.sh (lines 169-195) lets Darwin run without root and only requires root on Linux. Here, root is required for every platform, so a user who quickstarted on macOS without sudo can't quickclean without sudo. Suggest mirroring the same Darwin/Linux split:

♻️ Suggested mirror of quickstart's platform check
-# Check if the script is running as root
-if [ "$(id -u)" -ne 0 ]; then
-    echo "ERROR: This script must be run as root (use sudo)"
-    exit 1
-fi
+# Linux requires root; macOS uses the user's podman machine.
+if [[ "$(uname -s)" != "Darwin" ]] && [ "$(id -u)" -ne 0 ]; then
+    echo "ERROR: This script must be run as root (use sudo)"
+    exit 1
+fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/quickclean.sh` around lines 10 - 13, The root-enforcement in
quickclean.sh currently uses the id -u check unconditionally and should match
quickstart.sh's platform-specific logic; change the check to only require root
on non-Darwin platforms by detecting the OS via uname (e.g., test "$(uname -s)"
= "Darwin") and skip the id -u root check when on Darwin, otherwise keep the
existing id -u check and error message unchanged; update the conditional around
the id -u test in quickclean.sh accordingly so macOS users who ran quickstart
without sudo can run quickclean without sudo while Linux still requires root.
README.md (1)

32-33: ⚡ Quick win

Minimal macOS mention — consider a brief setup snippet.

The "including macOS" tag-on satisfies the literal ask, but new macOS users hitting this README still won't know they need a rootful Podman machine. Optional: add a short note (or link to a doc) with the four prerequisite commands from the PR description (brew install podman, podman machine init --memory 4096, podman machine set --rootful, podman machine start) so the Bootc quickstart actually works on macOS out of the box.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 32 - 33, The README currently only mentions
"including macOS" but lacks setup steps; add a short macOS prerequisite snippet
near the sentence that mentions macOS (the paragraph starting "MicroShift Bootc
container images can be run on `x86_64` and `aarch64`... including macOS") that
shows the four required Podman commands (brew install podman, podman machine
init --memory 4096, podman machine set --rootful, podman machine start) or a
link to a macOS-specific doc, so macOS users know they must create a rootful
Podman machine before following the quickstart.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/quickstart.sh`:
- Around line 70-85: The unquoted variable expansion ${machine_ssh} in
quickstart.sh triggers shellcheck SC2086 because it intentionally relies on
word-splitting; fix it either by adding a shellcheck suppression comment
immediately before the expansion (# shellcheck disable=SC2086) or by changing
machine_ssh to an array and invoking it as "${machine_ssh[@]}" where used;
locate the use of machine_ssh in the SSH command and apply one of these two
fixes and ensure any code that constructs machine_ssh is adjusted to produce an
array if you choose the array approach.

---

Nitpick comments:
In `@README.md`:
- Around line 32-33: The README currently only mentions "including macOS" but
lacks setup steps; add a short macOS prerequisite snippet near the sentence that
mentions macOS (the paragraph starting "MicroShift Bootc container images can be
run on `x86_64` and `aarch64`... including macOS") that shows the four required
Podman commands (brew install podman, podman machine init --memory 4096, podman
machine set --rootful, podman machine start) or a link to a macOS-specific doc,
so macOS users know they must create a rootful Podman machine before following
the quickstart.

In `@src/quickclean.sh`:
- Around line 10-13: The root-enforcement in quickclean.sh currently uses the id
-u check unconditionally and should match quickstart.sh's platform-specific
logic; change the check to only require root on non-Darwin platforms by
detecting the OS via uname (e.g., test "$(uname -s)" = "Darwin") and skip the id
-u root check when on Darwin, otherwise keep the existing id -u check and error
message unchanged; update the conditional around the id -u test in quickclean.sh
accordingly so macOS users who ran quickstart without sudo can run quickclean
without sudo while Linux still requires root.

In `@src/quickstart.sh`:
- Line 9: CONTAINER_NAME is assigned from positional $1 while the script uses
set -u which will treat unset positional parameters as errors and any later use
of shift would misalign args; to fix, either avoid consuming $1 directly by
using a named option parsing or preserve positional parameters (e.g., parse args
with getopts or copy $@ to another array) and update any shift logic
accordingly, or explicitly document and guard CONTAINER_NAME assignment so
future shift-based parsing isn’t off-by-one; refer to the CONTAINER_NAME
assignment and any subsequent shift or positional parsing logic to implement one
of these approaches.
- Around line 63-85: The Darwin branch's heredoc handling of lvm_disk differs
from Linux: after zeroing the existing lvm_disk with dd the Linux branch returns
immediately (return 0) but the Darwin branch continues to run
vgs/losetup/vgcreate, causing divergent reuse semantics; pick one behavior and
make both branches consistent—either (A) match Linux by causing the Darwin
heredoc to exit early after the dd (so the remote ssh block stops and the script
returns 0) or (B) match Darwin by removing the immediate return in the Linux
branch so both platforms proceed to vgs/losetup/vgcreate after zeroing; update
the code around lvm_disk handling (the dd/truncate logic) and the flow control
(return/exit) so lvm_disk and vg_name reuse is identical across platforms.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b39a70c8-cdad-477a-aa7f-c54ffcd8d98b

📥 Commits

Reviewing files that changed from the base of the PR and between bde3c43 and f0108ff.

📒 Files selected for processing (3)
  • README.md
  • src/quickclean.sh
  • src/quickstart.sh

Comment thread src/quickstart.sh Outdated
@agullon agullon force-pushed the macos-quickstart branch from f0108ff to f2d2ef7 Compare May 14, 2026 10:09
agullon added 2 commits May 14, 2026 12:16
quickstart.sh and quickclean.sh now detect macOS and handle podman
machine validation (rootful mode required) and LVM setup via
`podman machine ssh`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
Usage: ./src/quickstart.sh [name]  ./src/quickclean.sh [name]
Defaults to 'microshift-okd' when no argument is provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
@agullon agullon force-pushed the macos-quickstart branch from b37213d to c50e834 Compare May 14, 2026 10:16
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

pre-commit.check-secrets: ENABLED
Comment thread src/quickstart.sh

# Platform-specific initialization
if [[ "$(uname -s)" == "Darwin" ]]; then
if ! sudo -u "${SUDO_USER}" podman info &>/dev/null </dev/null; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need sudo here?

Comment thread src/quickstart.sh
exit 1
fi

local_rootful="$(sudo -u "${SUDO_USER}" podman machine inspect --format '{{.Rootful}}' 2>/dev/null || echo "false")"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove sudo?

Comment thread src/quickstart.sh
IMAGE=${IMAGE:-"ghcr.io/${OWNER}/${REPO}"}
TAG=${TAG:-latest}

CONTAINER_NAME="${1:-microshift-okd}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
CONTAINER_NAME="${1:-microshift-okd}"
CONTAINER_NAME="${CONTAINER_NAME:-microshift-okd}"

Comment thread src/quickclean.sh
#!/bin/bash
set -euo pipefail

CONTAINER_NAME="${1:-microshift-okd}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
CONTAINER_NAME="${1:-microshift-okd}"
CONTAINER_NAME="${CONTAINER_NAME:-microshift-okd}"

Comment thread src/quickstart.sh
echo
echo "To uninstall MicroShift, run the following command:"
echo " - curl -s https://${OWNER}.github.io/${REPO}/quickclean.sh | sudo bash"
echo " - curl -s https://${OWNER}.github.io/${REPO}/quickclean.sh | sudo bash -s ${CONTAINER_NAME}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
echo " - curl -s https://${OWNER}.github.io/${REPO}/quickclean.sh | sudo bash -s ${CONTAINER_NAME}"
echo " - curl -s https://${OWNER}.github.io/${REPO}/quickclean.sh | sudo CONTAINER_NAME=${CONTAINER_NAME} bash"

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