timsutton / osx-vm-templates

macOS templates for Packer and VeeWee.
MIT License
1.12k stars 248 forks source link

Ensure Xcode CLI Tools has most recent version selected #89

Closed rfwatson closed 6 years ago

rfwatson commented 6 years ago

When packaging 10.13 High Sierra, softwareupdate -l has the following output:

Software Update Tool

Finding available software
Software Update found the following new or updated software:
   * Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2
    Command Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended]
   * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.1
    Command Line Tools (macOS High Sierra version 10.13) for Xcode (9.1), 177264K [recommended]
   * macOS 10.13.1 Update-10.13.1
    macOS 10.13.1 Update (10.13.1), 1435937K [recommended] [restart]
   * iTunesX-12.7.1
    iTunes (12.7.1), 257176K [recommended]

Previously, the first matching Xcode CLI tools in the list was being selected for installation, which is not the most recent.

This change should ensure that the last matching item - the most recent - is selected instead.

timsutton commented 6 years ago

Thanks!

Curious, are you still getting this issue currently? Here's what I get on a dev High Sierra VM:

Software Update Tool

Finding available software
Software Update found the following new or updated software:
   * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.1
    Command Line Tools (macOS High Sierra version 10.13) for Xcode (9.1), 177264K [recommended]
   * macOS High Sierra 10.13.2 Developer Beta-3
    macOS High Sierra 10.13.2 Developer Beta (3), 2453892K [recommended] [restart]
   * iTunesXPatch-12.7.1
    iTunes (12.7.1), 185080K [recommended]

I've noticed on average once a year or two Apple has a slip-up with the developer tools in their software update catalogs, where either no CLI tools, or duplicates, are offered, and the time it takes them to resolve it is usually somewhere between a few hours and a few days.

Still makes sense to have this, and I just compared to what Homebrew last changed in their logic for this (which they indirectly borrowed from the script you just modified in this repo): https://github.com/Homebrew/install/commit/e294cc01d7f1c1a1b0b55789238ed3bddbede35b

I expect that since Homebrew has such broad usage, any issues we have with this method will probably be noticed by them first 😄

rfwatson commented 6 years ago

Thanks!

No problem. Thanks for creating these templates, they have proven very useful!

Curious, are you still getting this issue currently?

I'm afraid I don't have a non-updated VM kicking around right now to test this on, so I can't answer easily.

Good to see the Homebrew patch though - it strengthens my feeling that this is a "good enough" fix for the problem.