Skip to content

fix: update bootstrap_mac.sh with modern Homebrew installer and dependencies#1399

Open
Devansh-567 wants to merge 9 commits into
p4lang:mainfrom
Devansh-567:fix/update-macos-bootstrap-script
Open

fix: update bootstrap_mac.sh with modern Homebrew installer and dependencies#1399
Devansh-567 wants to merge 9 commits into
p4lang:mainfrom
Devansh-567:fix/update-macos-bootstrap-script

Conversation

@Devansh-567
Copy link
Copy Markdown
Contributor

Fixes #1396

Updates tools/macos/bootstrap_mac.sh to use modern macOS setup conventions:

  • Replace deprecated Ruby-based Homebrew installer with the current
    bash installer (https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
  • Add arm64/x86_64 detection for Apple Silicon support
  • Add brew_install helper to skip already-installed packages
  • Remove gcc@5 which is no longer available on modern Homebrew
  • Remove pcapy (deprecated) in favor of scapy's built-in capture
  • Update package list to match what bmv2 actually requires

Modeled after the approach used in p4c's tools/install_mac_deps.sh.

…dencies

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@fruffy
Copy link
Copy Markdown
Contributor

fruffy commented May 25, 2026

It would be good to have a CI check for this.

@Devansh-567
Copy link
Copy Markdown
Contributor Author

It would be good to have a CI check for this.

I have added a CI workflow in .github/workflows/test-macos-bootstrap.yml that tests the bootstrap script on macos-13 (x86_64), macos-14 (arm64), and macos-15 (arm64) whenever the script changes. It follows the same pattern as test.yml including the check-changes job and concurrency cancellation. Please let me know if you would like any adjustments.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@Devansh-567 Devansh-567 force-pushed the fix/update-macos-bootstrap-script branch from 27e444c to e373866 Compare May 26, 2026 08:04
@fruffy
Copy link
Copy Markdown
Contributor

fruffy commented May 26, 2026

You can skip macos-14. There are some errors now, which we likely need to fix.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@Devansh-567
Copy link
Copy Markdown
Contributor Author

Fixed - the pip3 install failure on macos-15 was due to PEP 668 which prevents system-wide pip installs on modern macOS. Added --break-system-packages flag to resolve it.

@fruffy
Copy link
Copy Markdown
Contributor

fruffy commented May 28, 2026

We can also drop macos-13 since Github likely does not have any runners left for that.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@jafingerhut
Copy link
Copy Markdown
Contributor

If I understand correctly, these changes are for a setup bash script for macOS. They do not actually build BMv2 on macOS, and neither does the macOS CI action?

If so, that is fine. Just curious if anyone has tried building BMv2 on macOS after running this updated setup script. And if that works, should the CI task also do so?

@Devansh-567
Copy link
Copy Markdown
Contributor Author

If I understand correctly, these changes are for a setup bash script for macOS. They do not actually build BMv2 on macOS, and neither does the macOS CI action?

If so, that is fine. Just curious if anyone has tried building BMv2 on macOS after running this updated setup script. And if that works, should the CI task also do so?

Good point. The current CI workflow only verifies that the bootstrap script runs without errors and that key packages are installed, it does not attempt to build BMv2 itself. I have not personally tested a full BMv2 build on macOS after running this script, as I don't have a macOS machine available. If you think it would be valuable, I can extend the CI workflow to attempt a BMv2 build after the bootstrap step, similar to what the Ubuntu jobs do in test.yml. That would give much stronger confidence that the script produces a working build environment. Let me know how you'd like to proceed.

@fruffy
Copy link
Copy Markdown
Contributor

fruffy commented May 29, 2026

If I understand correctly, these changes are for a setup bash script for macOS. They do not actually build BMv2 on macOS, and neither does the macOS CI action?
If so, that is fine. Just curious if anyone has tried building BMv2 on macOS after running this updated setup script. And if that works, should the CI task also do so?

Good point. The current CI workflow only verifies that the bootstrap script runs without errors and that key packages are installed, it does not attempt to build BMv2 itself. I have not personally tested a full BMv2 build on macOS after running this script, as I don't have a macOS machine available. If you think it would be valuable, I can extend the CI workflow to attempt a BMv2 build after the bootstrap step, similar to what the Ubuntu jobs do in test.yml. That would give much stronger confidence that the script produces a working build environment. Let me know how you'd like to proceed.

A full build is required. As is, the CI test is not very useful.

@jafingerhut
Copy link
Copy Markdown
Contributor

@Devansh-567 I understand that you do not have a local macOS system for testing out build steps, but if you are willing, you are perfectly welcome to use as many pushes re-triggering the CI run on Github to get it to work there. Feel free to add test commands in the script, e.g. echo commands or other things, if they help you discover what is failing (if any of your attempts fail to build). The normal output of all commands should be visible in the CI logs.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@Devansh-567
Copy link
Copy Markdown
Contributor Author

Added a full BMv2 build step to the CI workflow. It sets up the correct PATH for Homebrew bison and PKG_CONFIG_PATH for openssl before running autogen.sh, configure, and make. Using GitHub CI to iterate if anything fails as @jafingerhut suggested.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
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.

bootstrap_mac.sh uses deprecated Homebrew installer and outdated dependencies

3 participants