-
-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Labels
bugSomething isn't workingSomething isn't workingneeds-triageIssues that need triagingIssues that need triaging
Description
Steps to reproduce:
- Install required version of Zig
cd /tmp
curl -LO https://pkg.machengine.org/zig/zig-macos-aarch64-0.14.0-dev.2577+271452d22.tar.xz
tar -xf zig-macos-aarch64-0.14.0-dev.2577+271452d22.tar.xz
sudo mv zig-macos-aarch64-0.14.0-dev.2577+271452d22 /usr/local/zig-mach
Then add to your shell config (~/.zshrc):
export PATH="/usr/local/zig-mach:$PATH"
Reload shell and verify:
source ~/.zshrc
zig version
Shows 0.14.0-dev.2577+271452d22
- Set up project:
mkdir testproject
cd testproject
zig init
zig fetch --save https://pkg.machengine.org/mach/cfd9fc8ff0452f855bf5a8a7e53b611cae630254.tar.gz
- Replace
build.zigwith Getting Started file:
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Create our Mach app module, where all our code lives.
const app_mod = b.createModule(.{
.root_source_file = b.path("src/App.zig"),
.optimize = optimize,
.target = target,
});
// Add Mach import to our app.
const mach_dep = b.dependency("mach", .{
.target = target,
.optimize = optimize,
});
app_mod.addImport("mach", mach_dep.module("mach"));
// Have Mach create the executable for us
const exe = @import("mach").addExecutable(mach_dep.builder, .{
.name = "hello-world",
.app = app_mod,
.target = target,
.optimize = optimize,
});
b.installArtifact(exe);
// Run the app when `zig build run` is invoked
const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
// Run tests when `zig build test` is run
const app_unit_tests = b.addTest(.{
.root_module = app_mod,
});
const run_app_unit_tests = b.addRunArtifact(app_unit_tests);
const test_step = b.step("test", "Run unit tests");
test_step.dependOn(&run_app_unit_tests.step);
}
- Build
zig build
Things work fine here. No errors
- Run
zig build run
dyld[2430]: duplicate linked dylib '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation' in /Users/myusername/code/testproject/zig-out/bin/hello-world
dyld[2430]: duplicate linked dylib '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'
run
└─ run hello-world failure
error: the following command terminated unexpectedly:
/Users/myusername/code/testproject/zig-out/bin/hello-world
Build Summary: 20/22 steps succeeded; 1 failed
run transitive failure
└─ run hello-world failure
error: the following build command failed with exit code 1:
/Users/myusername/code/testproject/.zig-cache/o/89ed125a977de8a29072f018268a5a63/build /usr/local/zig-mach/zig /usr/local/zig-mach/lib /Users/myusername/code/testproject /Users/myusername/code/testproject/.zig-cache /Users/myusername/.cache/zig --seed 0x5b04228d -Z5bb0e7e83cfd0b57 run
Expected output:
zig build run should have exit code 0 and run something.
Additional system information:
TL;DR: Latest macOS w/ Silicon M2 processor.
Detailed system info:
➜ testproject zig version
0.14.0-dev.2577+271452d22
➜ testproject zig env
{
"zig_exe": "/usr/local/zig-mach/zig",
"lib_dir": "/usr/local/zig-mach/lib",
"std_dir": "/usr/local/zig-mach/lib/std",
"global_cache_dir": "/Users/myusername/.cache/zig",
"version": "0.14.0-dev.2577+271452d22",
"target": "aarch64-macos.26.0.1...26.0.1-none",
"env": {
"ZIG_GLOBAL_CACHE_DIR": null,
"ZIG_LOCAL_CACHE_DIR": null,
"ZIG_LIB_DIR": null,
"ZIG_LIBC": null,
"ZIG_BUILD_RUNNER": null,
"ZIG_VERBOSE_LINK": null,
"ZIG_VERBOSE_CC": null,
"ZIG_BTRFS_WORKAROUND": null,
"ZIG_DEBUG_CMD": null,
"CC": null,
"NO_COLOR": null,
"CLICOLOR_FORCE": null,
"XDG_CACHE_HOME": null,
"HOME": "/Users/myusername"
}
}
➜ testproject sw_vers
uname -a
system_profiler SPSoftwareDataType
system_profiler SPHardwareDataType
ProductName: macOS
ProductVersion: 26.0.1
BuildVersion: 25A362
Darwin Irinas-MacBook-Air.local 25.0.0 Darwin Kernel Version 25.0.0: Wed Sep 17 21:38:03 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8112 arm64
Software:
System Software Overview:
System Version: macOS 26.0.1 (25A362)
Kernel Version: Darwin 25.0.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: Irina’s MacBook Air
User Name: Nick (myusername)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 34 days, 13 hours, 47 minutes
Hardware:
Hardware Overview:
Model Name: MacBook Air
Model Identifier: Mac14,2
Model Number: MLY13LL/A
Chip: Apple M2
Total Number of Cores: 8 (4 performance and 4 efficiency)
Memory: 8 GB
System Firmware Version: 13822.1.2
OS Loader Version: 13822.1.2
Serial Number (system): P76J0W1JX4
Hardware UUID: 0B1B9148-AA14-556F-80EC-3024ADD50FD4
Provisioning UDID: 00008112-0019581E0A3BC01E
Activation Lock Status: Enabled
➜ testproject system_profiler SPDisplaysDataType
Graphics/Displays:
Apple M2:
Chipset Model: Apple M2
Type: GPU
Bus: Built-In
Total Number of Cores: 8
Vendor: Apple (0x106b)
Metal Support: Metal 4
Displays:
Color LCD:
Display Type: Built-in Liquid Retina Display
Resolution: 2560 x 1664 Retina
Main Display: Yes
Mirror: Off
Online: Yes
Automatically Adjust Brightness: Yes
Connection Type: Internal
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingneeds-triageIssues that need triagingIssues that need triaging