dockuti-command not found

johnnasset
Contributor

I just started playing with dockutil and am encountering an error when attempting to add a url to the dock. The command is:

sudo dockutil --add http://someaddresshere.com --label 'Website' --after Downloads

The web clip gets added in the appropriate location but the label isn't changed. The message in Terminal is:

-bash: --label: command not found

This is running the latest version of dockutil 1.1.4 on 10.8.4.

Thanks,
John

2 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor III

Indeed it is. Placing what you have above as an example into the command gives me the same error. Fortunately the simple workaround in a quick test is to surround the URL in single quotes-

sudo dockutil --add 'http://xxx.xxx.org/lms/sm.view?headless=1&action=home' --label 'Website' --after Downloads

Works fine for me like that.

View solution in original post

bentoms
Release Candidate Programs Tester

There is a default dock.plist in the resources folder of the Dock.app located in /System/Library/CoreServices/

I deploy that to all user templates & then use dockutil to edit.

I also delete the dockfixup.plist

View solution in original post

19 REPLIES 19

russeller
Contributor III

Have you tried a different OS to see if is specific to 10.8? I know dockutil and 10.8 don't really get along.

mm2270
Legendary Contributor III

The 1.1.4 release is supposed to be fully 10.8 compatible though. I'm still using version 1.1.2 on my 10.8.5 Mac, and I copied/pasted the above command and ran it and had no issues. It added a Dock icon labeled as "Website" with the generic URL icon to my Dock right after Downloads. No errors. So I'm not sure why you'd be getting that error other than possibly version 1.1.4 has broken that function?

Not applicable

Version 1.1.4 worked as expected for me on OS X 10.8.5, logged in under a mobile account with local admin rights using AD creds.

What kind of user account - local only, mobile, PHD? Have you tried using the same binary on the same system acting on a different user account?

johnnasset
Contributor

Looks like the url I was trying to add was the issue:

http://xxx.xxx.org/lms/sm.view?headless=1&action=home

Must be the question mark or ampersand.

mm2270
Legendary Contributor III

Indeed it is. Placing what you have above as an example into the command gives me the same error. Fortunately the simple workaround in a quick test is to surround the URL in single quotes-

sudo dockutil --add 'http://xxx.xxx.org/lms/sm.view?headless=1&action=home' --label 'Website' --after Downloads

Works fine for me like that.

johnnasset
Contributor

To add on to the questions (first day playing with dockutil). I'd like to add the web clip to the user template. When using the following command:

sudo dockutil --add 'http://somewebaddress.com/lms/sm.view?.etc' --label 'Website' --after Downloads --no-restart '/System/Library/Preferences/com.apple.dock.plist'

I get the following error:

/System/Library/User Template/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist

Thoughts?

mm2270
Legendary Contributor III

Try this-

sudo dockutil --add 'http://somewebaddress.com/lms/sm.view?.etc' --label 'Website' --after Downloads --no-restart '/System/Library/User Template/English.lproj'

You don't need to specify 'com.apple.dock.plist' at the end of the path. Since dockutil is designed to work on that plist file, you just supply the path to where that dock.plist should be and it finds it. It would be nice if it just ignored it if you accidentally add the plist into the path instead of spitting out an error, but that's how it currently works.
It may have even added the URL to the User Template's dock plist even though it showed you an error.

johnnasset
Contributor

Hmm, same error, entered as you have it above:

/System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist

I tried logging in as an AD user and created a new standard account through Users and Groups pref pane but didn't get the web clip in the dock.

mm2270
Legendary Contributor III

That's strange. I just tried it again on another test Mac here and it works perfectly. Created a new 'test' account in System Preferences afterwards and the URL link is showing up in the Dock exactly as specified and working. Well, it doesn't really go anywhere, but it drops the correct URL into the link.

I really don't know why you'd be getting that error. The only thing I can think of is somehow its not really running as root. Are you certain it had sudo in the command? Did you get prompted to enter admin credentials? I don't know what else it could be.

johnnasset
Contributor

Hmm, same issue running on 10.7.5. Are you running the latest version of dockutil? I'm running the command directly on the machine via Terminal. I'll try via ARD and a script in Casper Remote and see if I get the same error.

mm2270
Legendary Contributor III

I did my tests on 1.1.2, but I have version 1.1.4 installed now. I'll run a test in a moment and edit this post with results...

Edit: Success, it seems...

$ dockutil --version
1.1.4
$ sudo dockutil --add 'http://somewebaddress.com/lms/sm.view?.etc' --label 'Website' --after Downloads --no-restart '/System/Library/User Template/English.lproj'
Password:
$ sudo -s
bash-3.2# defaults read /System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist | grep -A3 "Website"
                label = Website;
                url =                 {
                    "_CFURLString" = "http://somewebaddress.com/lms/sm.view?.etc";
                    "_CFURLStringType" = 15;
bash-3.2#

Now, I haven't yet created a new account and logged in with it to see if its really showing up in the Dock, but when I get a moment, i can do that and see. But from what i can tell above with defaults, it appears the plist contains the 'Website' link with the correct URL in it. I also note it shows up after the 'Downloads' item in the plist.

Edit 2:
Created a new 'test' account after doing the above, logged into it and the Website URL link shows up in the Dock (after Downloads) and is functional. So... this works for me with both 1.1.2 and 1.1.4. This was done on 10.8.5, not any flavor of 10.7.
Not sure what else to say or to try. it may be something with your particular OS build. Can you test this against a vanilla OS install to see if it works that way?

mm2270
Legendary Contributor III

Hmm, I just thought of something that could be causing the issue for you, but I'm unsure.
Can you open a root shell or do a sudo command to actually list the contents of the /System/Library/User Template/English.lproj/Library/Preferences/ directory? See if a com.apple.dock.plist is actually there. Its possible the error you're getting is simply because the plist doesn't exist in the User Template somehow. I don't think dockutil can operate on a non existent dock plist.

This would be consistent with the error you're getting: /System/Library/User Template/English.lproj/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist

johnnasset
Contributor

Yep this file does exist in /System/Library/User Template

mm2270
Legendary Contributor III

Well, then I'm not sure what's going on. Is it a readable plist file? Permissions messed up on it perhaps? I just did a quick test by renaming the com.apple.dock.plist file in my own User Template directory, then re-ran the commands and I got the same error, so if dockutil isn't able to see or recognize the dock.plist it will report that error, it seems.

If you copy the plist from Terminal to your Desktop, can you view it in XCode or QuickLook? Or, can you read its contents with the defaults command? It just seems to me like the plist may be damaged or corrupted in some way and dockutil is getting tripped up on that.

johnnasset
Contributor

Correction, when I actually change the permissions of the User Template folder and looked in English.lproj/Library/Preferences, the com.apple.dock.plist doesn't exist. If there is no file, how is the test local account I created getting a dock? Is it all part of the dockfixup.plist?

bentoms
Release Candidate Programs Tester

There is a default dock.plist in the resources folder of the Dock.app located in /System/Library/CoreServices/

I deploy that to all user templates & then use dockutil to edit.

I also delete the dockfixup.plist

mm2270
Legendary Contributor III

Well, that explains it then. If its not there, dockutil will error, as mentioned.
And yes, @bentoms is correct. Simply not having one in the User Template doesn't mean a new account doesn't get a dock.plist. The OS is smart enough to just copy the default one from the app into place, BUT it defers to the one in User Template if its there, and only falls back to its default if needed. But this only happens on account creation, not going forward afterwards.

For example, as a test, use Terminal to delete the com.apple.dock.plist file from an existing user account on the system. Then log in as that user and you'll see a default Dock. When you go back into the user's Preferences folder a newly created com.apple.dock.plist file will be there.

johnnasset
Contributor

Okay, ready to kill this thread but one last question. Here is my attempt to create a shell script to push out via a policy, etc. Not sure my currentuser variable is set correctly. I don't do a log of scripting so I"m sure a quick view by one of you guru's would be sufficient:

#!/bin/bash

# Apply the dockutil settings to current user

currentuser=ls -l /dev/console | awk '{ print $3 }'

/usr/local/bin/dockutil --remove all "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Launchpad.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Safari.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft Word.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft Excel.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications/Self Service.app' "/Users/$currentuser"
/usr/local/bin/dockutil --add '/Applications' --view grid --display folder "/Users/$currentuser"

# Remove
/usr/local/bin/dockutil --remove 'App Store' --no-restart "/Users/$currentuser"
/usr/local/bin/dockutil --remove 'Reminders' --no-restart "/Users/$currentuser"
/usr/local/bin/dockutil --remove 'Notes' --no-restart "/Users/$currentuser"

mm2270
Legendary Contributor III

The currentuser variable would be correct except that you need to either surround the command in back tick marks ( ` ) or, my preferred method, in $(..), meaning, either:

currentuser=`ls -l /dev/console | awk '{ print $3 }'`

or

currentuser=$( ls -l /dev/console | awk '{ print $3 }' )

The way it is now won't work since it won't see it as a command to run to populate the variable.
I haven't really looked over the rest of the script.

Edit: One final thing. If no-one is logged in at the time the script runs, $currentuser will return as "root" and subsequent dockutil commands will fail since you're directing it to /Users/$currentuser. You can fix that easily (sort of) by just checking that the $currentuser variable returned isn't == "root"

if [ "$currentuser" != "root" ]; then
## Do your adds and remove stuff here
else
   echo "No-one is logged in. Exiting..."
   exit 0
fi