elliotweiser / ansible-osx-command-line-tools

An Ansible role for installing OS X Command Line Tools
https://galaxy.ansible.com/elliotweiser/osx-command-line-tools/
MIT License
97 stars 42 forks source link

macOS 12 compatibility #69

Open That-Dude opened 2 years ago

That-Dude commented 2 years ago

I'm a Github/Ansible newb so apologies if I'm doing something wrong here.

When I run your CLT install playbook agains macOS 12 it forces a user dialogue to appear on the screen and the playbook fails until the user actions it.

I altered a bash script I found elsewhere to work with macOS 12 but I have no idea how to amend your code to use it. Here's the code I altered that works fine over SSH.

#!/bin/bash
# Only run if the tools are not installed yet
xcode-select -p &> /dev/null
if [ $? -ne 0 ]; then
  touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
  PROD=$(softwareupdate -l |
    grep "\*.*Command Line" |
    tail -n 1 | sed 's/^[^C]* //')
  softwareupdate -i "$PROD" --verbose;
else
  echo "Xcode CLI tools already installed"
fi
elliotweiser commented 2 years ago

Hi @That-Dude . Try forking this repository and opening a pull-request with these changes applied to the tasks:

https://github.com/elliotweiser/ansible-osx-command-line-tools/blob/master/tasks/main.yml

You'll notice that in this file, the role is doing many of the same things as you described (split across several tasks), but there may need to be some modification to address compatibility with newer MacOS versions. Feel free to submit your change and I'll review. Thanks!