Giter Club home page Giter Club logo

Comments (11)

jps3 avatar jps3 commented on July 28, 2024

I am seeing the same behavior on my lab Macs (still on 10.8). Using the latest v2.0.0.

In "def readPlist()" is the line "subprocess.Popen(['defaults', 'export', plist_path, export_fifo]).communicate()". If 10.8 there is no 'export' command for 'defaults'.

from dockutil.

kcrawford avatar kcrawford commented on July 28, 2024

Please test with master using jps3 fix.

from dockutil.

jps3 avatar jps3 commented on July 28, 2024

Remotely logged into lab Mac running 10.8.5 via ssh...

OS X version of client being tested

bash-3.2$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.8.5
BuildVersion:   12F45

Cloning dockutil/master*

bash-3.2$ git clone https://github.com/kcrawford/dockutil.git dockutil-master
Cloning into 'dockutil-master'...
remote: Reusing existing pack: 108, done.
remote: Counting objects: 5, done.
remote: Compressing objects:  25% (1/4)   remote: Compressing objects:  50% (2/4)   remote: Compressing objects:  75% (3/4)   remote: Compressing objects: 100% (4/4)   remote: Compressing objects: 100% (4/4), done.
Receiving objects: 100% (113/113), 36.22 KiB | 0 bytes/s, done.
Resolving deltas: 100% (33/33), done.
Checking connectivity... done.
bash-3.2$ cd dockutil-master

Run current master version of dockutil

bash-3.2$ ./scripts/dockutil --list
Launchpad   file://localhost/Applications/Launchpad.app/    persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Mission Control file://localhost/Applications/Mission%20Control.app/    persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Safari  file://localhost/Applications/Safari.app/   persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Mail    file://localhost/Applications/Mail.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Contacts    file://localhost/Applications/Contacts.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Calendar    file://localhost/Applications/Calendar.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Reminders   file://localhost/Applications/Reminders.app/    persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Notes   file://localhost/Applications/Notes.app/    persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Messages    file://localhost/Applications/Messages.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
FaceTime    file://localhost/Applications/FaceTime.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Photo Booth file://localhost/Applications/Photo%20Booth.app/    persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
iTunes  file://localhost/Applications/iTunes.app/   persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
App Store   file://localhost/Applications/App%20Store.app/  persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
System Preferences  file://localhost/Applications/System%20Preferences.app/ persistent-apps /var/.home/ladmin/Library/Preferences/com.apple.dock.plist
Downloads   file://localhost/private/var/.home/ladmin/Downloads/    persistent-others   /var/.home/ladmin/Library/Preferences/com.apple.dock.plist

Version information of current master version of dockutil

bash-3.2$ ./scripts/dockutil --version
2.0.0

Running deployed version of dockutil in lab

bash-3.2$ /usr/local/bin/dockutil --list
Command line interface to a user's defaults.
Syntax:

'defaults' [-currentHost | -host <hostname>] followed by one of the following:

  read                                 shows all defaults
  read <domain>                        shows defaults for given domain
  read <domain> <key>                  shows defaults for given domain, key

  read-type <domain> <key>             shows the type for the given domain, key

  write <domain> <domain_rep>          writes domain (overwrites existing)
  write <domain> <key> <value>         writes key for domain

  rename <domain> <old_key> <new_key>  renames old_key to new_key

  delete <domain>                      deletes domain
  delete <domain> <key>                deletes key in domain

  domains                              lists all domains
  find <word>                          lists all entries containing word
  help                                 print this help

<domain> is ( <domain_name> | -app <application_name> | -globalDomain )
         or a path to a file omitting the '.plist' extension

<value> is one of:
  <value_rep>
  -string <string_value>
  -data <hex_digits>
  -int[eger] <integer_value>
  -float  <floating-point_value>
  -bool[ean] (true | false | yes | no)
  -date <date_rep>
  -array <value1> <value2> ...
  -array-add <value1> <value2> ...
  -dict <key1> <value1> <key2> <value2> ...
  -dict-add <key1> <value1> ...
^CTraceback (most recent call last):
  File "/usr/local/bin/dockutil", line 628, in <module>
    main()
  File "/usr/local/bin/dockutil", line 266, in main
    pl = readPlist(plist_path)
  File "/usr/local/bin/dockutil", line 395, in readPlist
    plist_string = subprocess.Popen(['plutil', '-convert', 'xml1', export_fifo, '-o', '-'], stdout=subprocess.PIPE).stdout.read()
KeyboardInterrupt

Version information of deployed version of dockutil in lab

bash-3.2$ /usr/local/bin/dockutil --version
2.0.0

Diff between currently deployed version in lab and current master (to help make sure comparing versions correctly)

bash-3.2$ diff -u -w /usr/local/bin/dockutil ./scripts/dockutil
--- /usr/local/bin/dockutil 2014-06-18 10:27:32.000000000 -0400
+++ ./scripts/dockutil  2014-06-25 16:17:20.000000000 -0400
@@ -20,6 +20,7 @@
 # tie in with application identifier codes for locating apps and replacing them in the dock with newer versions?

 import sys, plistlib, subprocess, os, getopt, re, pipes, tempfile, pwd
+import platform


 # default verbose printing to off
@@ -381,6 +382,15 @@
     except:
         return False

+def getOsxVersion():
+    """returns a tuple with the (major,minor,revision) numbers"""
+    try:
+        mac_ver = tuple( [ int(n) for n in platform.mac_ver()[0].split('.') ] )
+        assert len(mac_ver) == 3
+    except Exception as e:
+        raise e
+    return mac_ver
+
 def readPlist(plist_path):
     """returns a plist object read from a file path"""
     # get the unescaped path
@@ -390,9 +400,18 @@
     # make a fifo for defaults export in a temp file
     os.mkfifo(export_fifo)
     # export to the fifo
+    osx_version = getOsxVersion()
+    if osx_version[1] >= 9:
     subprocess.Popen(['defaults', 'export', plist_path, export_fifo]).communicate()
     # convert the export to xml
     plist_string = subprocess.Popen(['plutil', '-convert', 'xml1', export_fifo, '-o', '-'], stdout=subprocess.PIPE).stdout.read()
+    else:
+        try:
+            cmd = ['/usr/libexec/PlistBuddy','-x','-c', 'print',plist_path]
+            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            (plist_string,err) = proc.communicate()
+        except Exception as e:
+            raise e
     # parse the xml into a dictionary
     pl = plistlib.readPlistFromString(plist_string)
     return pl

from dockutil.

karthikeyan-mac avatar karthikeyan-mac commented on July 28, 2024

dcokutil --list works with master, but --add or --remove does not work in 10.8. it gives the "defaults" help text.

from dockutil.

jps3 avatar jps3 commented on July 28, 2024

D'Oh! Obviously I only looked at the part of the problem I was currently interested in before I issued the pull request.

Kyle: I've started some changes in my fork of dockutil in my branch fix_for_pre_Mavericks_defaults_differences that I hope may be useful at some point. (If this is not a help but a hindrance, please let me know, I will not take offense; also I do not recommend anyone else here use anything other than Kyle's repo, by the way.) I had a brainstorm on some ideas I thought might help out, and what is there is what I have gotten to so far.

from dockutil.

kcrawford avatar kcrawford commented on July 28, 2024

I will likely be merging #23. So just be aware there are some changes there too.

from dockutil.

mosman2k avatar mosman2k commented on July 28, 2024

Hi there, Im having a problem with Dockutil on my 10.8 images, although it works fine for my 10.9 and 10.10 images?
Im not great with Scripts etc. so please go easy on me, but here is the script im using (that works for 10.9/10.10 -

#!/bin/bash

Apply the dockutil settings to current logging in user $3

/usr/bin/dockutil --remove all /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Safari.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Photoshop CS6/Adobe Photoshop CS6.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Illustrator CS6/Adobe Illustrator.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/System Preferences.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft Word.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Self Service.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Preview.app' /Users/$3

Whether thats enough info im not sure, but is there something needed within the script that 10.8's need spacifically?
Any help will be appreciated...

from dockutil.

kcrawford avatar kcrawford commented on July 28, 2024

I think there are some known issues with 2.0 on 10.8.5.

Until those are fixed I recommend using the last 1.x version.

Kyle

Sent from Mobile

On Mar 27, 2015, at 5:58 AM, mosman2k [email protected] wrote:

Hi there, Im having a problem with Dockutil on my 10.8 images, although it works fine for my 10.9 and 10.10 images?
Im not great with Scripts etc. so please go easy on me, but here is the script im using (that works for 10.9/10.10 -

#!/bin/bash

Apply the dockutil settings to current logging in user $3

/usr/bin/dockutil --remove all /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Safari.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Photoshop CS6/Adobe Photoshop CS6.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Illustrator CS6/Adobe Illustrator.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/System Preferences.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft Word.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Self Service.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Preview.app' /Users/$3

Whether thats enough info im not sure, but is there something needed within the script that 10.8's need spacifically?
Any help will be appreciated...


Reply to this email directly or view it on GitHub.

from dockutil.

mosman2k avatar mosman2k commented on July 28, 2024

Hi Kyle,

Thanks for getting back to me.

I have downloaded the previous edition of dockutil (1.1.4), obviously the script I’m using now will not work in conjunction with, so looking at my script, is there anything you could suggest updating so that it works for 10.8 with the 1.1.4 dockutil script in?

Again, sorry but my scripting skill are next to nothing and I’m not sure entirely how to adapt a script to suit my 10.8 OS and dockutil 1.1.4?

Many thanks in advance and I hope that was a stupid question and made some sort of sense.

Mark

From: Kyle Crawford [mailto:[email protected]]
Sent: 27 March 2015 14:13
To: kcrawford/dockutil
Cc: Mark Osman
Subject: Re: [dockutil] dockutil 2.0.0 not working on 10.8 (#17)

I think there are some known issues with 2.0 on 10.8.5.

Until those are fixed I recommend using the last 1.x version.

Kyle

Sent from Mobile

On Mar 27, 2015, at 5:58 AM, mosman2k <[email protected]mailto:[email protected]> wrote:

Hi there, Im having a problem with Dockutil on my 10.8 images, although it works fine for my 10.9 and 10.10 images?
Im not great with Scripts etc. so please go easy on me, but here is the script im using (that works for 10.9/10.10 -

#!/bin/bash

Apply the dockutil settings to current logging in user $3

/usr/bin/dockutil --remove all /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Safari.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Photoshop CS6/Adobe Photoshop CS6.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Illustrator CS6/Adobe Illustrator.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/System Preferences.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft Word.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Self Service.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Preview.app' /Users/$3

Whether thats enough info im not sure, but is there something needed within the script that 10.8's need spacifically?
Any help will be appreciated...


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-86952327.


The information contained in or attached to this email is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it. It may contain information which is confidential and/or covered by legal professional or other privilege (or other rules or laws with similar effect in jurisdictions outside England and Wales).
The views expressed in this email are not necessarily the views of Brockenhurst College, and their directors, officers or employees make no representation or accept any liability for its accuracy or completeness unless expressly stated to the contrary. .

2012 www.brock.ac.uk


from dockutil.

erikng avatar erikng commented on July 28, 2024

Perhaps install both tools on your machines and name them dockutil-1.0 and dockutil-2.0 depending on the OS version. In your script use an if statement to look for each version and based on what is installed, run your parameters.

Sent from my iPhone

On Mar 27, 2015, at 10:21 AM, mosman2k [email protected] wrote:

Hi Kyle,

Thanks for getting back to me.

I have downloaded the previous edition of dockutil (1.1.4), obviously the script I’m using now will not work in conjunction with, so looking at my script, is there anything you could suggest updating so that it works for 10.8 with the 1.1.4 dockutil script in?

Again, sorry but my scripting skill are next to nothing and I’m not sure entirely how to adapt a script to suit my 10.8 OS and dockutil 1.1.4?

Many thanks in advance and I hope that was a stupid question and made some sort of sense.

Mark

From: Kyle Crawford [mailto:[email protected]]
Sent: 27 March 2015 14:13
To: kcrawford/dockutil
Cc: Mark Osman
Subject: Re: [dockutil] dockutil 2.0.0 not working on 10.8 (#17)

I think there are some known issues with 2.0 on 10.8.5.

Until those are fixed I recommend using the last 1.x version.

Kyle

Sent from Mobile

On Mar 27, 2015, at 5:58 AM, mosman2k <[email protected]mailto:[email protected]> wrote:

Hi there, Im having a problem with Dockutil on my 10.8 images, although it works fine for my 10.9 and 10.10 images?
Im not great with Scripts etc. so please go easy on me, but here is the script im using (that works for 10.9/10.10 -

#!/bin/bash

Apply the dockutil settings to current logging in user $3

/usr/bin/dockutil --remove all /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Safari.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Photoshop CS6/Adobe Photoshop CS6.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Adobe Illustrator CS6/Adobe Illustrator.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/System Preferences.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft Word.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Microsoft Office 2011/Microsoft PowerPoint.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Self Service.app' /Users/$3
/usr/bin/dockutil --no restart --add '/Applications/Preview.app' /Users/$3

Whether thats enough info im not sure, but is there something needed within the script that 10.8's need spacifically?
Any help will be appreciated...


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHubhttps://github.com//issues/17#issuecomment-86952327.


The information contained in or attached to this email is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are not authorised to and must not disclose, copy, distribute, or retain this message or any part of it. It may contain information which is confidential and/or covered by legal professional or other privilege (or other rules or laws with similar effect in jurisdictions outside England and Wales).
The views expressed in this email are not necessarily the views of Brockenhurst College, and their directors, officers or employees make no representation or accept any liability for its accuracy or completeness unless expressly stated to the contrary. .

2012 www.brock.ac.uk



Reply to this email directly or view it on GitHub.

from dockutil.

kcrawford avatar kcrawford commented on July 28, 2024

I don't think we will go back and fix this on 10.8 at this point. I'm going to close this.

from dockutil.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.