Skip to content

fix: add macOS build support#4

Open
DonaldoDes wants to merge 2 commits intomobydeck:mainfrom
DonaldoDes:fix/macos-build-support
Open

fix: add macOS build support#4
DonaldoDes wants to merge 2 commits intomobydeck:mainfrom
DonaldoDes:fix/macos-build-support

Conversation

@DonaldoDes
Copy link

Summary

  • Add conditional compilation for macOS: <util.h> instead of <pty.h> (via HAVE_UTIL_H / HAVE_PTY_H in config.h)
  • Make -static flag conditional in Makefile (disabled on Darwin, macOS doesn't support statically linked binaries)
  • Scope unused variables buf and fd in master.c to the #else branch where they're actually used (fixes -Wunused warnings on macOS)

Closes #2

Test plan

  • make clean && make compiles without errors or warnings on macOS (Apple clang)
  • make clean && make still compiles on Linux (no regression)
  • 175/176 tests pass (1 pre-existing flaky test unrelated to these changes)
  • Session create, detach, list, reattach, and history replay all work on macOS

Changes

File Change
config.h __APPLE__ guard → HAVE_UTIL_H
atch.h #ifdef HAVE_UTIL_H include
makefile UNAME_S conditional for -static
master.c Scoped buf/fd to #else block

🤖 Generated with Claude Code

DonaldoDes and others added 2 commits March 10, 2026 13:44
- config.h: use HAVE_UTIL_H on __APPLE__ instead of HAVE_PTY_H
  (<pty.h> does not exist on macOS, <util.h> provides openpty/forkpty)
- atch.h: add #ifdef HAVE_UTIL_H guard to include <util.h>
- makefile: STATIC_FLAG is empty on Darwin, -static on Linux
  (Apple toolchain does not support fully static binaries)

Fixes: https://github.com/mobydeck/atch/issues/<building-on-macos>
Variables were declared at block scope but only used in the #else
branch, causing -Wunused-variable and -Wunused-but-set-variable
warnings on platforms where TIOCSCTTY is defined (e.g. macOS).

Move declarations into the #else block where they are actually used.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.

Building on macOS

1 participant