Skip to content

install.sh fails on Linux: undefined unix.TIOCGETA/TIOCSETA in internal/tmux/terminal.go #22

@istonikula

Description

@istonikula

Summary

./install.sh fails on Linux during the "Installing cavekit command..." step because internal/tmux/terminal.go uses BSD/Darwin-only termios ioctl constants with no build tag.

Environment

  • OS: Linux (amd64)
  • Go: 1.26.2
  • golang.org/x/sys: v0.30.0

Error

# github.com/JuliusBrussee/cavekit/internal/tmux
internal/tmux/terminal.go:11:53: undefined: unix.TIOCGETA
internal/tmux/terminal.go:27:47: undefined: unix.TIOCSETA
internal/tmux/terminal.go:37:38: undefined: unix.TIOCSETA

Root cause

unix.TIOCGETA / unix.TIOCSETA are only defined in golang.org/x/sys/unix for Darwin and the BSDs. On Linux the equivalents are unix.TCGETS / unix.TCSETS (different ioctl numbers on Linux/glibc).

internal/tmux/terminal.go has no //go:build constraint, so Go compiles it on every Unix and the build breaks on Linux. Looks like it was written/tested on macOS only.

Suggested fixes

  1. Replace TIOCGETA/TIOCSETA with TCGETS/TCSETS — works on both Linux and Darwin (Darwin defines both).
  2. Or split into terminal_darwin.go / terminal_linux.go with //go:build tags.
  3. Simplest: use golang.org/x/term's MakeRaw / Restore, which already handles per-OS ioctl names.

Adding a Linux job to CI would catch this class of regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions