# List the extensions installed in Safari for Mac OS X, and state whether each one is enabled

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.

-
possible duplicate of List the extensions enabled in Safari for Mac OS X –  patrix Feb 4 '12 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. –  Graham Perrin Feb 4 '12 at 11:25
Would you consider just amending one of the questions to say "List the installed extensions and their status"? –  stuffe Feb 4 '12 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. –  Graham Perrin Feb 4 '12 at 12:06
Don't think so... –  patrix Feb 4 '12 at 13:11

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 - 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 '12 at 14:06 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. – Graham Perrin Feb 5 '12 at 6:26 Which extensions are missing? – patrix Feb 5 '12 at 8:27 Ah, who would have thought that disabled items aren't identified by "Enabled = 0;". Grrr, going to have a look at it tonight. – patrix Feb 6 '12 at 6:04 Fixed for now. As it is nearly impossible to predict any format changes, I didn't even try to cover them :-) – patrix Feb 6 '12 at 19:17 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. - 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.

-
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. –  Graham Perrin Feb 6 '12 at 23:43
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 '12 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. –  Graham Perrin Feb 8 '12 at 18:13
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 '12 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 … –  Graham Perrin Feb 8 '12 at 18:55

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.
-
Better, meaning what? –  bneely Feb 4 '12 at 12:25
I expanded the opening question. Thanks. –  Graham Perrin Feb 4 '12 at 12:38