kcrawford / dockutil

command line tool for managing dock items
http://patternbuffer.wordpress.com
Apache License 2.0
1.37k stars 131 forks source link

dockutil --add fails with several errors #84

Closed tjluoma closed 10 months ago

tjluoma commented 5 years ago

I've tried several commands like these:

dockutil --add '/Applications'
dockutil --add /Applications/Launchpad.app
dockutil --add '/Volumes' --view list --display stack --sort name

and they all failed with similar (but entirely-cryptic-to-me) errors, which I collected here

dockutil-errors.txt

This is on a MacBookAir8,1 aka MacBook Air (Retina, 13-inch, 2018) which is running:

ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G87

(aka "latest Mojave, non-beta)

Oh and I'm using dockutil version 2.0.5 installed via Homebrew.

kcrawford commented 5 years ago

It looks like you are manually removing sections from the dock plist that dockutil expects.

dockutil should handle that situation so it needs to be fixed but in the meantime maybe if you restart the dock it will add the sections back. Otherwise drag items in and out of your dock to get the sections back.

When python expects something but it is missing you often get an attribute error.

Kyle

Sent from Mobile

On Aug 5, 2019, at 6:56 PM, TJ Luoma notifications@github.com wrote:

I've tried several commands like these:

dockutil --add '/Applications' dockutil --add /Applications/Launchpad.app dockutil --add '/Volumes' --view list --display stack --sort name and they all failed with similar (but entirely-cryptic-to-me) errors, which I collected here

dockutil-errors.txt

This is on a MacBookAir8,1 aka MacBook Air (Retina, 13-inch, 2018) which is running:

ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: 18G87 (aka "latest Mojave, non-beta)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tjluoma commented 5 years ago

Ah, yes, that’s true… this was part of several modifications that I was trying to make at once. One issue that I was trying to avoid was restarting the dock after each modification. Perhaps I should do it once after defaults write and defaults delete commands and before the dockutil commands.

Is there a way in dockutil to add several folders/apps to the dock and then restart the dock once, rather than after each dockutil command?

Thanks!

Tj

On Tue, Aug 6, 2019, at 1:51 AM, Kyle Crawford wrote:

It looks like you are manually removing sections from the dock plist that dockutil expects.

dockutil should handle that situation so it needs to be fixed but in the meantime maybe if you restart the dock it will add the sections back. Otherwise drag items in and out of your dock to get the sections back.

When python expects something but it is missing you often get an attribute error.

Kyle

Sent from Mobile

On Aug 5, 2019, at 6:56 PM, TJ Luoma notifications@github.com wrote:

I've tried several commands like these:

dockutil --add '/Applications' dockutil --add /Applications/Launchpad.app dockutil --add '/Volumes' --view list --display stack --sort name and they all failed with similar (but entirely-cryptic-to-me) errors, which I collected here

dockutil-errors.txt

This is on a MacBookAir8,1 aka MacBook Air (Retina, 13-inch, 2018) which is running:

ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: 18G87 (aka "latest Mojave, non-beta)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kcrawford/dockutil/issues/84?email_source=notifications&email_token=AAAGSVPX275OYVVSKS3LJ2DQDEGMHA5CNFSM4IJP6TW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3T6EQI#issuecomment-518513217, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAGSVLX77QISNKTWF2FG6TQDEGMHANCNFSM4IJP6TWQ.

kcrawford commented 5 years ago

Yes I think there is a no restart option you can use.

Kyle

Sent from Mobile

On Aug 6, 2019, at 12:32 PM, TJ Luoma notifications@github.com wrote:

Ah, yes, that’s true… this was part of several modifications that I was trying to make at once. One issue that I was trying to avoid was restarting the dock after each modification. Perhaps I should do it once after defaults write and defaults delete commands and before the dockutil commands.

Is there a way in dockutil to add several folders/apps to the dock and then restart the dock once, rather than after each dockutil command?

Thanks!

Tj

On Tue, Aug 6, 2019, at 1:51 AM, Kyle Crawford wrote:

It looks like you are manually removing sections from the dock plist that dockutil expects.

dockutil should handle that situation so it needs to be fixed but in the meantime maybe if you restart the dock it will add the sections back. Otherwise drag items in and out of your dock to get the sections back.

When python expects something but it is missing you often get an attribute error.

Kyle

Sent from Mobile

On Aug 5, 2019, at 6:56 PM, TJ Luoma notifications@github.com wrote:

I've tried several commands like these:

dockutil --add '/Applications' dockutil --add /Applications/Launchpad.app dockutil --add '/Volumes' --view list --display stack --sort name and they all failed with similar (but entirely-cryptic-to-me) errors, which I collected here

dockutil-errors.txt

This is on a MacBookAir8,1 aka MacBook Air (Retina, 13-inch, 2018) which is running:

ProductName: Mac OS X ProductVersion: 10.14.6 BuildVersion: 18G87 (aka "latest Mojave, non-beta)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kcrawford/dockutil/issues/84?email_source=notifications&email_token=AAAGSVPX275OYVVSKS3LJ2DQDEGMHA5CNFSM4IJP6TW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3T6EQI#issuecomment-518513217, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAGSVLX77QISNKTWF2FG6TQDEGMHANCNFSM4IJP6TWQ.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

tjluoma commented 5 years ago

On Tue, Aug 6, 2019, at 3:10 PM, Kyle Crawford wrote:

Yes I think there is a no restart option you can use.

Ah! So there is… --no-restart

Does killall Dock suffice to manually restart the Dock, or does dockutil have some special method of doing it better?

Thanks again!

Tj

kcrawford commented 5 years ago

I think killall is what dockutil is using. Should be fine.

Kyle

Sent from Mobile

On Aug 6, 2019, at 4:17 PM, TJ Luoma notifications@github.com wrote:

On Tue, Aug 6, 2019, at 3:10 PM, Kyle Crawford wrote:

Yes I think there is a no restart option you can use.

Ah! So there is… --no-restart

Does killall Dock suffice to manually restart the Dock, or does dockutil have some special method of doing it better?

Thanks again!

Tj

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

tep74 commented 5 years ago

I'm seeing similar errors just when running a simple --add

Gerst20051 commented 4 years ago

Yeah, this was working perfectly fine before I updated to macOS Catalina.

When I run dockutil --add /Applications/Slack.app I get the following error message.

Slack already exists in dock. Use --replacing 'Slack' to update an existing item
item /Applications/Slack.app was not added to Dock

That error message comes from this line: https://github.com/kcrawford/dockutil/blob/b2900281ba51575d1cda7f6905382e89df5d286d/scripts/dockutil#L569

We can see that it's using the plist file on this line: https://github.com/kcrawford/dockutil/blob/b2900281ba51575d1cda7f6905382e89df5d286d/scripts/dockutil#L245

~/Library/Preferences/com.apple.dock.plist

Maybe something changed with this plist file?

It could be related to this issue about the GUID format here: https://github.com/kcrawford/dockutil/issues/83

I can see the second part of the error message is from this line: https://github.com/kcrawford/dockutil/blob/b2900281ba51575d1cda7f6905382e89df5d286d/scripts/dockutil#L391

Actually, after looking through the code I can't figure out how it's possible to throw that error and still actually work (the items are added to the dock).

kcrawford commented 10 months ago

I'm going to close this older issue as dockutil was rewritten and updated. Please open a new issue if you can still reproduce the problem in latest dockutil. Thanks for using dockutil and reporting the issue.