geerlingguy/mac-dev-playbook

Dockutil error

will62185 opened this issue ยท 6 comments

When running $ ansible-playbook main.yml -K --tags "dock" error msg: '[Errno 2] No such file or directory: b''dockutil''' is observed.

System info: MacOS Monterey 12.4 (21F79) on M1 Macbook Pro

Found this issue from Dockutil repo: kcrawford/dockutil#127

Command output:

PLAY [all] ****************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************************************************************************************************
[WARNING]: Platform darwin on host 127.0.0.1 is using the discovered Python interpreter at /opt/homebrew/bin/python3.9, but future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-core/2.12/reference_appendices/interpreter_discovery.html for more information.
ok: [127.0.0.1]

TASK [Include playbook configuration.] ************************************************************************************************************************************************************************************
ok: [127.0.0.1] => (item=/Users/{USER}/src/mac-dev-playbook/config.yml)

TASK [geerlingguy.mac.dock : Install dockutil.] ***************************************************************************************************************************************************************************
changed: [127.0.0.1]

TASK [geerlingguy.mac.dock : Remove configured Dock items.] ***************************************************************************************************************************************************************

TASK [geerlingguy.mac.dock : Ensure required dock items exist.] ***********************************************************************************************************************************************************
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'Google Chrome', 'path': '/Applications/Google Chrome.app/', 'pos': 3})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'Firefox', 'path': '/Applications/Firefox.app/', 'pos': 4})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'Slack', 'path': '/Applications/Slack.app/', 'pos': 5})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'iTerm', 'path': '/Applications/iTerm.app/', 'pos': 6})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'Visual Studio Code', 'path': '/Applications/Visual Studio Code.app/', 'pos': 7})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'Sublime Text', 'path': '/Applications/Sublime Text.app/', 'pos': 8})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': '1Password', 'path': '/Applications/1Password.app/', 'pos': 9})
included: /Users/{USER}/.ansible/collections/ansible_collections/geerlingguy/mac/roles/dock/tasks/dock-add.yml for 127.0.0.1 => (item={'name': 'AWS VPN Client', 'path': '/Applications/AWS VPN Client/AWS VPN Client.app/', 'pos': 10})

TASK [geerlingguy.mac.dock : See if Dock item Google Chrome exists.] ******************************************************************************************************************************************************
ok: [127.0.0.1]

TASK [geerlingguy.mac.dock : Ensure Dock item Google Chrome exists.] ******************************************************************************************************************************************************
fatal: [127.0.0.1]: FAILED! => changed=false 
  cmd: dockutil --add '/Applications/Google Chrome.app/'
  msg: '[Errno 2] No such file or directory: b''dockutil'''
  rc: 2
  stderr: ''
  stderr_lines: <omitted>
  stdout: ''

Some context: as newer MacOS don't have python, docutilwas rewritten in swift. Not sure how it is installed in this playbook, it should be possible to just add it as a home-brew install. However, there are issues with that, see eg

As a temporary workaround adding hpedrorodrigues/tools/dockutilto the home-brew cask section works.

As a temporary workaround adding hpedrorodrigues/tools/dockutilto the home-brew cask section works.

Thanks @einSelbst i'll give the workaround a try.

lotyp commented

@will62185 as by now there is mess with all that, you can use my roles

There are several issues right now,

  1. in Ansible itself - ansible-collections/community.general#4708 (comment),
  2. in Homebrew with merging dockutil - Homebrew/homebrew-core#97394
  3. in dockutil - kcrawford/dockutil#127
  4. and in geerlingguy roles and collections, which depends on all that, mentioned in 1. and 2.

I've invested time to fix all that.

My roles:

Third link can be replaced with hpedrorodrigues/tools/dockutil as @einSelbst mentioned

@geerlingguy I'm really sorry, as this looks like we are using your repo issues section for adverts for our code ๐Ÿ˜€

Hi @einSelbst @lotyp, I wanted to report back that the workaround for docktuil worked great. Thank you both.

Merging this discussion into #42, which is the original report.

Thanks for the feedback @geerlingguy . However, reading through #42 it doesnt seem to be related. This bug report is regarding the tool called -dockutil-, which places an app in the dock, but #42 is about dotfiles.