Skip to content

docs: add macOS development guide for issue #1465#1564

Open
AAdIprog wants to merge 1 commit intokmesh-net:mainfrom
AAdIprog:docs/macos-development-guide-1465
Open

docs: add macOS development guide for issue #1465#1564
AAdIprog wants to merge 1 commit intokmesh-net:mainfrom
AAdIprog:docs/macos-development-guide-1465

Conversation

@AAdIprog
Copy link
Copy Markdown

What type of PR is this?

/kind documentation

What this PR does / why we need it:

This PR adds a comprehensive macOS Developer Guide for Kmesh. Since Kmesh relies heavily on eBPF/BPF features that require a Linux kernel, macOS developers need guidance on setting up a proper development environment.

The guide covers:

  • Overview of available options (UTM, dual-boot, Lima, Docker Desktop) with recommendations
  • Known limitations of Lima and Docker Desktop for BPF development
  • What macOS developers can and cannot do without a Linux environment
  • Step-by-step instructions for setting up UTM with Ubuntu VM (recommended approach)
  • Dual-boot Ubuntu setup instructions for Intel Macs
  • VS Code Remote SSH workflow for development
  • Troubleshooting common issues
  • Verification steps to test BPF support

Which issue(s) this PR fixes:
Fixes #1465

Special notes for your reviewer:

This guide is based on practical experience setting up Kmesh development on macOS. Key highlights:

  • Lima is explicitly marked as not recommended due to BPF operations causing kernel panics
  • UTM is recommended as the best balance of convenience and full BPF support
  • Includes GitHub Codespaces as an alternative for developers who don't want local VMs

Does this PR introduce a user-facing change?:

Added macOS Developer Guide documentation to help macOS users set up a development environment for Kmesh using UTM/Ubuntu VM or dual-boot.

Copilot AI review requested due to automatic review settings January 10, 2026 10:18
@kmesh-bot
Copy link
Copy Markdown
Collaborator

@AAdIprog: The label(s) kind/documentation cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind documentation

What this PR does / why we need it:

This PR adds a comprehensive macOS Developer Guide for Kmesh. Since Kmesh relies heavily on eBPF/BPF features that require a Linux kernel, macOS developers need guidance on setting up a proper development environment.

The guide covers:

  • Overview of available options (UTM, dual-boot, Lima, Docker Desktop) with recommendations
  • Known limitations of Lima and Docker Desktop for BPF development
  • What macOS developers can and cannot do without a Linux environment
  • Step-by-step instructions for setting up UTM with Ubuntu VM (recommended approach)
  • Dual-boot Ubuntu setup instructions for Intel Macs
  • VS Code Remote SSH workflow for development
  • Troubleshooting common issues
  • Verification steps to test BPF support

Which issue(s) this PR fixes:
Fixes #1465

Special notes for your reviewer:

This guide is based on practical experience setting up Kmesh development on macOS. Key highlights:

  • Lima is explicitly marked as not recommended due to BPF operations causing kernel panics
  • UTM is recommended as the best balance of convenience and full BPF support
  • Includes GitHub Codespaces as an alternative for developers who don't want local VMs

Does this PR introduce a user-facing change?:

Added macOS Developer Guide documentation to help macOS users set up a development environment for Kmesh using UTM/Ubuntu VM or dual-boot.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kmesh-bot
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign yaozengzeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kmesh-bot
Copy link
Copy Markdown
Collaborator

Welcome @AAdIprog! It looks like this is your first PR to kmesh-net/kmesh 🎉

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @AAdIprog, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a detailed macOS Developer Guide for Kmesh, addressing the inherent challenge of Kmesh's dependency on Linux kernel's eBPF/BPF features. The guide provides clear recommendations for setting up a suitable development environment, primarily focusing on virtualization with UTM and Ubuntu, or dual-booting Ubuntu for optimal performance. It also clarifies the scope of development possible directly on macOS and offers cloud-based alternatives, ensuring macOS users can effectively contribute to Kmesh.

Highlights

  • New macOS Development Guide: A comprehensive guide has been added to assist macOS developers in setting up their environment for Kmesh, which heavily relies on eBPF/BPF features requiring a Linux kernel.
  • Recommended Development Environments: The guide recommends using UTM with an Ubuntu VM or dual-booting Ubuntu (for Intel Macs) to achieve full BPF support necessary for Kmesh development.
  • Limitations of Existing Tools: It explicitly advises against using Lima and Docker Desktop for Kmesh BPF development, citing consistent failures and kernel panics with Lima, and lack of full BPF capabilities in Docker Desktop.
  • Flexible Development Options: The guide outlines what Kmesh development tasks can be performed directly on macOS without a Linux environment and suggests GitHub Codespaces as a cloud-based alternative for full Linux development.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Mac's sleek, but BPF Needs Linux, strong and true, to Make Kmesh truly fly.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a comprehensive macOS developer guide, which is a great addition for developers on that platform. The guide is well-structured and covers various setup options. I've found a few incorrect commands and some confusing instructions in the documentation that could prevent users from successfully setting up their environment. My review includes suggestions to correct these issues.

Comment thread docs/en/macos_development_guide.md Outdated
golangci-lint run

# Generate documentation
make gen-docs
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The command make gen-docs is incorrect as this target does not exist in the project's Makefile. The correct target for generating documentation appears to be gen-kmeshctl-doc. Please update the command to ensure users can successfully generate the documentation.

Suggested change
make gen-docs
make gen-kmeshctl-doc

Comment thread docs/en/macos_development_guide.md Outdated
Comment on lines +216 to +217
# Install virtiofs support
sudo apt install -y virtiofsd
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The command sudo apt install -y virtiofsd is incorrect for the guest VM. virtiofsd is a daemon that runs on the host, which UTM manages. The guest VM only needs to mount the shared filesystem. On recent Ubuntu versions with a modern kernel, the necessary virtiofs module should be included, and no extra packages are needed. This installation step is unnecessary and should be removed.

Comment thread docs/en/macos_development_guide.md Outdated

# Run Kmesh BPF tests
cd kmesh
make test-bpf
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The command make test-bpf is incorrect as the test-bpf target does not exist in the Makefile. Based on the Makefile and helper scripts, the correct target for running BPF unit tests is ebpf_unit_test.

Suggested change
make test-bpf
make ebpf_unit_test

Comment on lines +319 to +324
```bash
# For UTM with VirtioFS
sudo apt install -y spice-vdagent spice-webdavd

# Restart the VM after installation
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The troubleshooting advice for shared folders is confusing. It suggests installing SPICE guest tools (spice-vdagent, spice-webdavd), but the setup guide in "Step 7: Shared Folders (Optional)" describes using VirtioFS. These are two different methods for folder sharing. To avoid confusion, this section should provide troubleshooting steps relevant to VirtioFS, not SPICE. For example, it could mention checking dmesg for virtio_fs errors or verifying mount options.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds comprehensive documentation to help macOS developers set up a proper development environment for Kmesh, which requires Linux kernel eBPF/BPF features that are not available on macOS.

Changes:

  • Added a new macOS Developer Guide with multiple virtualization options and their tradeoffs
  • Documented known limitations of Lima and Docker Desktop for BPF development
  • Provided step-by-step setup instructions for UTM with Ubuntu VM and dual-boot configurations
  • Included troubleshooting guidance and development workflow tips

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +163 to +169
# Install Go (check https://go.dev/dl/ for latest version)
wget https://go.dev/dl/go1.21.5.linux-arm64.tar.gz # For ARM64
# OR
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz # For AMD64

sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.*.tar.gz
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The Go version specified (1.21.5) may be outdated. Consider either referencing a more recent version or using a version variable that can be easily updated. The comment on line 163 mentions checking the official Go downloads page, but having a more recent version here would be helpful for users who follow the instructions directly.

Suggested change
# Install Go (check https://go.dev/dl/ for latest version)
wget https://go.dev/dl/go1.21.5.linux-arm64.tar.gz # For ARM64
# OR
wget https://go.dev/dl/go1.21.5.linux-amd64.tar.gz # For AMD64
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.*.tar.gz
# Install Go (set GO_VERSION based on https://go.dev/dl/)
GO_VERSION=1.22.5 # Replace with the latest stable version if different
wget https://go.dev/dl/go${GO_VERSION}.linux-arm64.tar.gz # For ARM64
# OR
wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz # For AMD64
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-*.tar.gz

Copilot uses AI. Check for mistakes.
@AAdIprog AAdIprog force-pushed the docs/macos-development-guide-1465 branch from f722043 to f5f4797 Compare January 10, 2026 11:19
Signed-off-by: AAdIprog <aadishah132@gmail.com>
@AAdIprog AAdIprog force-pushed the docs/macos-development-guide-1465 branch from f5f4797 to af109c2 Compare January 10, 2026 11:26
Copilot AI review requested due to automatic review settings January 10, 2026 11:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mount | grep bpf

# If not mounted, mount it
sudo mount -t bpf bpf /sys/fs/bpf
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

The mount command is incorrect. Based on the project's codebase (build/docker/start_kmesh.sh and test/e2e/run_test.sh), the correct command should be 'mount -t bpf none /sys/fs/bpf', not 'mount -t bpf bpf /sys/fs/bpf'. The device argument should be 'none', not 'bpf'.

Suggested change
sudo mount -t bpf bpf /sys/fs/bpf
sudo mount -t bpf none /sys/fs/bpf

Copilot uses AI. Check for mistakes.

# Add Go to PATH
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

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

Using single quotes prevents shell variable expansion. The command 'echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc' will literally write the string '$(go env GOPATH)' to .bashrc without expanding it. Either use double quotes for the echo command or use a separate command to evaluate and export GOPATH.

Suggested change
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
echo "export PATH=\$PATH:$(go env GOPATH)/bin" >> ~/.bashrc

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@LiZhenCheng9527 LiZhenCheng9527 left a comment

Choose a reason for hiding this comment

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

Have you actually run Kmesh on macOS? Or this guide may well have been generated by AI?

| **Lima** | ❌ Limited | Good | Easy | ❌ No |
| **Docker Desktop** | ❌ None | Good | Easy | ❌ No |

## ⚠️ Known Limitations
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.

Is better to me if you can delete unnecessary emoji.

cd kmesh

# Run non-BPF unit tests (some tests will be skipped)
go test ./pkg/... -v -short
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.

Some unit tests under the pkg directory require BPF.

sudo apt install -y build-essential git curl wget

# Install Go (check https://go.dev/dl/ for latest version)
wget https://go.dev/dl/go1.21.5.linux-arm64.tar.gz # For ARM64
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.

why go 1.21.5? Kmesh use go 1.24.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac Developer Onboarding: Documenting BPF/BPF+Lima Limitations and VM Workarounds (related to #375)

4 participants