Skip to content

CHEF-34733: Add Habitat plan for macOS aarch64-darwin platform#345

Draft
sanghinitin wants to merge 1 commit into
mainfrom
CHEF-34733-mac-os-hab-pkg
Draft

CHEF-34733: Add Habitat plan for macOS aarch64-darwin platform#345
sanghinitin wants to merge 1 commit into
mainfrom
CHEF-34733-mac-os-hab-pkg

Conversation

@sanghinitin

Copy link
Copy Markdown
Contributor

Summary

Adds a new Habitat package plan for the macOS aarch64-darwin (Apple Silicon) platform, enabling hab pkg build for chef-cli on macOS ARM64.

Jira Ticket

CHEF-34733

Changes

  • Created habitat/aarch64-darwin/plan.sh - full Habitat plan for macOS ARM64

Key Design Decisions

AreaDecisionRationale
Compiler toolchain Uses core/clang instead of core/gcc core/gcc is unavailable on aarch64-darwin; clang is the native macOS compiler
Native extension build deps Added core/make and core/cmake to pkg_build_deps Required by libyajl2 gem which compiles yajl C library via cmake
CC/CXX export Points to Habitat core/clang bin path, not xcrun xcrun is unavailable inside Habitat build environment
PATH in do_prepare/do_build Prepends cmake, make, clang bin dirs Ensures native gem extensions find build tools during bundle install
HOME and GEM_SPEC_CACHE Set to writable Habitat cache paths Prevents Bundler Errno::ENOENT - getcwd and RubyGems permission errors
sed syntax Uses GNU sed -i (no empty string arg) Habitat provides GNU sed on PATH; BSD sed -i with empty arg causes read error
Runtime wrapper Sets DYLD_LIBRARY_PATH for libarchive macOS uses DYLD_LIBRARY_PATH (not LD_LIBRARY_PATH) for dynamic library resolution

Issues Resolved During Development

  1. Errno::ENOENT getcwd - Bundler could not resolve working directory; fixed by exporting HOME to source cache dir
  2. libyajl2 native extension build failure - extconf.rb requires cmake and make; added both to pkg_build_deps and ensured they are on PATH
  3. sed read error - BSD sed syntax incompatible with GNU sed in Habitat; removed empty string argument from sed -i
  4. rm typo - rm - rf (extra space) treated - and rf as filenames; fixed to rm -rf

Build Validation

$ hab pkg build .
# Build completes successfully
# Generated .hart artifact under results/
$ hab pkg install results/sanghinitin-chef-cli-6.1.34-*.hart
$ hab pkg exec sanghinitin/chef-cli chef-cli --version

Files Modified

  • habitat/aarch64-darwin/plan.sh (new file, +138 lines)

Testing

Validated via hab pkg build . on macOS aarch64-darwin. Build completes, .hart installs, and chef-cli --version executes correctly via hab pkg exec.

Signed-off-by: nitin sanghi <nsanghi@progress.com>
@sanghinitin sanghinitin requested review from a team as code owners June 24, 2026 10:41
@sanghinitin sanghinitin added the Type: Enhancement Adds new functionality. label Jun 24, 2026
@sanghinitin sanghinitin requested a review from a team as a code owner June 24, 2026 10:41
@sanghinitin sanghinitin added ai-assisted and removed Type: Enhancement Adds new functionality. labels Jun 24, 2026
@sanghinitin sanghinitin marked this pull request as draft June 24, 2026 10:41
@github-actions

Copy link
Copy Markdown

Simplecov Report

Covered Threshold
98.51% 90%

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant