3

I'd like a list, from which text can be copied.

(Not a screenshot of preferences.)

This information does not appear in any of the following:

  • Safari
  • System Profiler in Snow Leopard
  • System Information in Lion.

I wondered whether there exists an extension to list other extensions, but when I searched I could not find anything suitable.

If not a command or an extension, maybe there's an app, but again: I could not find anything suitable.

(I could instead have posted this opening question to Super User, where a command piping guru might step up, but I prefer Ask Different for the likelihood of someone knowing an extension or app.)

Background

With the extensions master switch off, the simple presence of installed extensions may cause some versions of Safari to take longer than expected to launch.

For that reason and others, it's sometimes necessary to have a comprehensive list of installed extensions, including those that are disabled.

5
  • 1
    possible duplicate of List the extensions enabled in Safari for Mac OS X
    – nohillside
    Feb 4, 2012 at 10:52
  • No, it's a different question. Linked. I'll edit the subject line here and there to emhpasise the words installed and enabled. Feb 4, 2012 at 11:25
  • 2
    Would you consider just amending one of the questions to say "List the installed extensions and their status"?
    – stuffe
    Feb 4, 2012 at 11:28
  • I thought about this for weeks before posting. Considering what's in the property list, at the moment I strongly believe that mixing the two questions will make it unnecessarily difficult for people to formulate a single answer. The prominent link from one question to the other should be enough for people to think constructively about a co-ordinated approach, should they wish. Please, don't close this question. Feb 4, 2012 at 12:06
  • 1
    Don't think so...
    – nohillside
    Feb 4, 2012 at 13:11

4 Answers 4

6

It's primarily a matter of parsing the output of defaults read ~/Library/Safari/Extensions/extensions and formatting it in a user-friendly way. The result actually answers both of your questions:

defaults read ~/Library/Safari/Extensions/extensions | awk '
/Bundle Directory/ {
    split($0, t, /\"/);
    sub(".safariextension", "", t[4]);
    sub("-1", "", t[4]);
    bundle=t[4]
    e="disabled"
}
/Enabled/ {
    e="enabled";
}
/Hidden Bars/ {
    print bundle, "...", e
}' | sort --ignore-case

Creating a shell script out of it is left as an exercise to the reader.

Please note that this will most probably stop to work if Apple decides to change the format of ~/Library/Safari/Extensions/extensions

7
  • 1
    Perfect answer, on my system it provides the following output: YouTube5 is enabled 1Password is enabled Footnotify is enabled. Throw this script into an automator service if you want to avoid heading for the terminal.
    – stuffe
    Feb 4, 2012 at 14:06
  • 1
    The result is a subset, not a full list of extensions. patrix, would you like to repeat this answer under the other question? Then we can refine the answer here. Many thanks. Feb 5, 2012 at 6:26
  • 1
    Which extensions are missing?
    – nohillside
    Feb 5, 2012 at 8:27
  • 1
    Here, all those that are disabled are missing from the list. Are you using the most recent version of Mac OS X? If it helps, there's an example of a .plist (not my own) at pastebin.com/mWwt21hW Feb 5, 2012 at 21:58
  • 2
    Ah, who would have thought that disabled items aren't identified by "Enabled = 0;". Grrr, going to have a look at it tonight.
    – nohillside
    Feb 6, 2012 at 6:04
1

For posterity, another simple starting point that originated from what was once a different question:

List of enabled extensions, unsorted

defaults read ~/Library/Safari/Extensions/extensions | grep -B 1 "Enabled = 1"

The result is quick, but dirty:

  • for each item found there are three lines, one should suffice
  • in the one line of interest, the leading "Bundle Directory Name" = " and trailing "; are unnecessary
  • some of the bundle directory names include -1 — this, too, is unnecessary.

For Safari in pre-release build 16A319 of macOS Sierra (Mac OS X 10.12)

defaults read ~/Library/Safari/Extensions/extensions | grep -B 5 "Enabled = 1"
-1
touch ~/Library/Safari/Extensions/extensions
defaults read ~/Library/Safari/Extensions/extensions | awk '
/Bundle Directory/ {
    split($0, t, /\"/);
    sub(".safariextension", "", t[4]);
    sub("-1", "", t[4]);
    bundle=t[4]
    e=""
}
/Enabled/ {
    e="... enabled";
}
/Hidden Bars/ {
    print bundle, e
}' | sort --ignore-case

This variation on the accepted answer includes extensions that are disabled without labelling them as such. A personal preference — the resulting white space helps me to see, at a glance, those that are enabled.

5
  • From this, I created a simple app: Safari extension lister 1.0. Thanks again to patrix for the accepted answer, without which I could not have done this. Feb 6, 2012 at 23:43
  • 1
    The extension lister looks cool. I'd say leave all the various sorting of the outputs out of this question as it's really a command line text parsing lesson and not really part of the core question. Where can I get a list?
    – bmike
    Feb 7, 2012 at 17:23
  • bmike you're right, I upped your comment. There's some refinement of this away from Ask Different, but at the moment it doesn't translate to a separate well-formed question. Excuse me please if I make an occasional change to this answer. Eventually I might delete it. Feb 8, 2012 at 18:13
  • 1
    Perhaps it would be better as it's own question - how can I sort a list in various ways and then just linked as a comment to your primary answer? I'm not sure there's a right answer - just my thoughts. You get to drive and you certainly can keep lots of answers here - it's not wrong by any means.
    – bmike
    Feb 8, 2012 at 18:28
  • Background, for the curious: pastebin.com/GsF30UsV — extract from a version 9 crash log produced by CrashReporter. Ignoring for a moment the absence of extensions that are disabled, there's an ideal level of detail. However we do not wish to crash Safari to get information of this type, so I'm toying with information from a variety of sources … Feb 8, 2012 at 18:55
-1

A simple starting point, posted at the same time as the opening question:

Simple list of installed extensions, sorted alphabetically

defaults read ~/Library/Safari/Extensions/extensions | grep "Bundle Directory Name" | sort --ignore-case

The result is quick, but dirty:

  • in the one line of interest, the leading "Bundle Directory Name" = " and trailing "; are unnecessary
  • some of the bundle directory names include -1 — this, too, is unnecessary.
1
  • Better, meaning what?
    – bneely
    Feb 4, 2012 at 12:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .