setup-python fails on self-hosted macOS: newer darwin Python assets require interactive sudo (installer -pkg)

Open
#1,388 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
github-actions, macos, shell, typescript
Domain
ci-cd, devops

Research direction

The failing sudo installer -pkg call comes from the generated setup.sh, built from installers/macos-pkg-setup-template.sh (line 50) in actions/python-versions, so that template is the first file to read. The error surfaces in setup-python's install-from-prebuilt-package step, which is where an explicit failure message would go. Done means either a documented sudo requirement or a clear error for the no-TTY case, and the maintainers still need to decide whether a relocatable layout is in scope.

Written by the indexing model from the issue text.

Description

Problem

On a self-hosted macOS runner, actions/setup-python@v7 fails for Python versions whose darwin asset installs via sudo installer -pkg (e.g. 3.12.10):

Version 3.12 was not found in the local cache
Download from .../python-3.12.10-darwin-arm64.tar.gz
Execute installation script
Check if Python hostedtoolcache folder exist...
Install Python binaries from prebuilt package
##[error]sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

The asset's setup.sh (generated from actions/python-versions installers/macos-pkg-setup-template.sh, line 50) runs:

sudo installer -pkg $PYTHON_PKG_NAME ... -target /

The runner service user has no TTY, so any host without passwordless sudo for /usr/sbin/installer fails. Older assets (e.g. 3.11.9) shipped plain directory trees and installed unprivileged.

Suggestion

Document the sudo requirement and/or fail with an explicit message; a relocatable (unprivileged) darwin asset layout would remove the requirement entirely.

Related: #914, #1387.

🤖 Generated with Claude Code

Dominant language
TypeScript
Stars
2.3k
Forks
752
Avg merge
22d 15h
Merged PRs (30d)
1

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from actions/setup-python

All issues in actions/setup-python

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.