pivotal / workstation-setup

Scripts to automatically set up a machine for development the "Tanzu Labs" way
https://github.com/pivotal/workstation-setup
MIT License
328 stars 247 forks source link

Mac OS 12.3: configuration-osx.sh script fails with /usr/bin/python: bad interpreter: No such file or directory #316

Closed 0x2615 closed 2 years ago

0x2615 commented 2 years ago

Issue

I ran setup with the following options:

./setup.sh concourse cred-alert docker golang java java-tools kubernetes python terraform

When setup reached the 'Customizing OS X configuration' stage; i.e. when it ran ./scripts/common/configuration-osx.sh. The output was as follows:

Customizing OS X configuration
==> Downloading https://ghcr.io/v2/homebrew/core/dockutil/manifests/2.0.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/dockutil/blobs/sha256:f5f87d9e286c2b294bb157ac9f87baa2720fff044c7a92c0b80b9cb82db8a87e
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:f5f87d9e286c2b294bb157ac9f87baa2720fff044c7a92c0b80b9cb82db8a87e?se=2022-05-18T14%3A10%3A00Z&sig=4ycdeVcBC7Qymk981FwZ%2BpuL7npmu5tqChx2nzP8U
######################################################################## 100.0%
==> Pouring dockutil--2.0.5.all.bottle.tar.gz
🍺  /opt/homebrew/Cellar/dockutil/2.0.5: 4 files, 37.9KB
==> Running `brew cleanup dockutil`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
./scripts/common/configuration-osx.sh: /opt/homebrew/bin/dockutil: /usr/bin/python: bad interpreter: No such file or directory
./scripts/common/configuration-osx.sh: /opt/homebrew/bin/dockutil: /usr/bin/python: bad interpreter: No such file or directory
mirzasa@Sams-MacBook-Pro workstation-setup-main %

It seems that dockutil version 2.0.5 requires Python 2.7, which has been removed from Mac OS. See: https://github.com/kcrawford/dockutil/issues/127

I worked around this issue by running the following commands:

brew uninstall dockutil
brew install jq
DLURL=$(curl --silent "https://api.github.com/repos/kcrawford/dockutil/releases/latest" | jq -r '.assets[].browser_download_url' | grep pkg)
curl -sL ${DLURL} -o /tmp/dockutil.pkg
sudo installer -pkg "/tmp/dockutil.pkg" -target /
rm /tmp/dockutil.pkg

I stole most of this from the issue I have linked to above. I then re-ran setup and got past the 'Customizing OS X configuration' stage.

Possible Solutions

  1. Wait for dockutil to be updated in Homebrew, it seems a PR is in progress: https://github.com/Homebrew/homebrew-core/pull/97394
  2. Implement the workaround I used in ./scripts/common/configuration-osx.sh

I'd be happy to open a PR for this if you're keen on option 2

joemoore commented 2 years ago

Thank you for the report; I'll take a look as soon as I can. Feel free to keep updating this issue or submit a PR.

joemoore commented 2 years ago

I realize we had to fix a version of this before. #308

joemoore commented 2 years ago

I'm tempted to remove that dockutil section entirely. This troublesome section attempts to make a minimalist OS X Dock. Do we get much value from:

Thoughts?

0x2615 commented 2 years ago

Thanks @joemoore. I think dockutil is quite useful. A fresh install of mac OS seems to put a load of guff in the dock that is not needed. I would prefer to keep dockutil and have a minimalist Dock.

There has been activity on the PR I linked to, but there doesn't seem to have been any actual progress.

Someone has created a Homebrew cask for the updated version of dockutil, perhaps we could just use that for now? See: https://github.com/hpedrorodrigues/homebrew-tools/blob/master/Casks/dockutil.rb