Skip to content

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

Open

Description

@dahai80

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

Activity

  1. v-mahabaleshwars commented on Nov 16, 2026

    @v-mahabaleshwars
    Contributor

    Thanks for reporting this and suggesting improvements.
    As noted in #1306, macOS .pkg installation requires elevated privileges. Pre-installing the required Python version in the tool cache can avoid installation during the workflow. this sudo requirement is not specific to Python 3.12; it also applies to other package-based macOS versions, including Python 3.11.9, please check the discussion in #760
    Thanks also for PR #1387. It addresses the related custom cache-path issue, but not the sudo requirement.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions