I am using Safari on macOS Sierra. I have added several commonly-used sites to my favorites section, like so:

My favorites icons

(there are 10 icons, and all but 2 of them are displayed as the proper, correct icon from the site. For example, the Wikipedia icon has the large W icon. However, for Google Drive and Gmail, the icons are just big, ugly, generic G's)

I would like for the two Google sites to correctly display their icons as well. At first, I thought it was because all 8 of the "correctly displayed" sites had successfully configured their "Safari settings" or something like that, while Google failed to do this (although this doesn't sound too plausible).

However, if I instead go to the top menu in Safari, click Bookmarks > Show Bookmarks, I get the following:

My bookmarks list

Strangely, this time, the two Google sites do have correctly displayed icons, while it is instead three other sites (out of the 10) that aren't displayed: namely Wikipedia, Amazon, and New York Times.

So it seems that there are two sets of icons, "big" and "small", and for big icons, Google Drive and Gmail are not displayed correctly, while the other 8 are, and on the other hand, for small icons, Google Drive and Gmail are displayed correctly, while Wikipedia, Amazon, and NYTimes are not.

I actually don't care too much about the small icons, but I would really like for all the big icons to display correctly. How can I do that?

  • This has been a long-standing issue for me too… but as of yesterday, I noticed that all the icons have suddenly reappeared, as if by magic. Has anyone else noticed this? Was this a quiet fix to Safari 15.5?
    – Kal
    Commented Jun 4, 2022 at 3:47

3 Answers 3

# Fix Safari Favorites Icons

CS="cache_settings"; TIC="Touch Icons Cache"; DIR="$HOME/Library/Safari/$TIC/Images"
DB="$DIR/../${${TIC// }%%s*}${${(C)CS}//_}.db"; SQL=$(sqlite3 "$DB" "SELECT host FROM $CS")
sqlite3 "$DB" "UPDATE $CS SET ${${${(L)TIC// /_}#*_}//s/_is_in}=1, download_status_flags=1"
for png in "$1"/*.png; do URL="$(plutil -convert xml1 -o - "$DIR/../../Bookmarks.plist" | \
awk -F '[</>]' -v name="${${png##*/}%%.*}" '$3~name{getline;getline;getline;print $5}')"; \
cp -f -v "$png" "$DIR/${(U)$(md5 -q -s $URL)}.png"; done; chflags -v uappnd $DIR $DB

From here: https://gist.github.com/dardo82/f7cc7c5c864fb5afa04bb12ecbcf3a9f

The script takes a folder with the missing touch icons as its only argument.

Each favicon needs to have the same name as the bookmark associated with it.

The newly updated gist works with Safari 13 but now if you clear the browser cache the added favicons disappear in the new tab and reappear upon restart!

  • 1
    this is a fix nice and simple fix. I was confused about how to use the script at first before reading this answer more carefully, but I'll describe explicitly an example for those of us like me who rarely run shell scripts: if, say the bookmark named "Gmail" is not displaying an icon, download any suitable icon, such as this, put it in some folder such as ~/Desktop, cd to that folder, rename the file "Gmail.png" then do "zsh fixicon", where fixicon is a text file containing the script above, and has been "chmod +x"ed.
    – xdavidliu
    Commented Dec 15, 2017 at 9:58
  • Yes,you are right,thanks for taking the time to me more verbose than me...
    – dardo82
    Commented Dec 16, 2017 at 9:15
  • If someone is wondering it still works, at least on my machine using OSX 10.13.6 and Safari 13.1.2
    – dardo82
    Commented Oct 26, 2021 at 0:04
  • What does md5: option requires an argument -- s mean? I have my other Mac here (Macbook Pro M1 Pro), the script works perfectly. But on my Macbook Air M1, it returns that error? Commented May 2, 2022 at 18:19
  • Maybe something has changed in macOS.🤓
    – dardo82
    Commented May 3, 2022 at 16:54

Here's a hack that works very nicely (it takes a moderate amount of simple image manipulation though. Also, see a note at the very bottom of this answer in order not to completely lose this fix and have to redo it). it seems that the issue is that the the icons given by the websites were designed for the bookmark bar, which has smaller icons, and not the safari favorites screen, which has larger icons (at least 144 x 144). Update: certain newer versions of Mac OS which come with Safari 15, such as Monterey and potentially Big Sur, use an icon size of 128 x 128.

The icons themselves are stored in ~/Library/Safari/Touch Icons Cache/Images/, with very long names (something like "908F6BBF6DA814ABAF917C4E7BB9E36F.png"). When a new Favorite is added (say New York Times, in the case of the original question), and the icon correctly displays in the Favorites screen, then a 144 x 144 png file appears in the aforementioned Cache folder, and everything's good and spiffy. However, if, say Gmail is added, and a big ugly, non-descript G appears instead of the nice Gmail icon, then that means a tiny png (designed for a bookmark bar instead of favorite screen) appeared in the Cache folder. (alternatively, if not even an incorrect tiny png appears in that folder, simply favorite another "decoy" site that does make a png file appear, perform the following, and then modify the Name and URL of the favorite later).

So in order to correct the icon, simply create another png that has the correct 144 x 144 resolution (see note below), then use that created png to replace the tiny "incorrect" file in the Touch Icons Cache folder, making sure to keep the long filename constant. Exit out of Safari (Command-Q) and restart, and the icon appears perfectly, as so:

Fixed favorites screen

Note that Gmail and Google Drive now have the correct icons. I had to do the same thing for The Economist as well, since that site also did not provide a proper 144 x 144 favicon.

For a very simple way of creating a 144 x 144 icon using just Preview, simply download a high-res image of the icon (Gmail, Google Drive), or whatever, open in preview, then tools->adjust size to 144 width. Now put this image aside and call it "image A". Note that transparency sometimes causes trouble for safari favicons (e.g. if a region of a picture is colorless, the color actually displayed in those regions might be inconsistent). If this happens, we can make a white background. To do this, simply do command-shift-4 and drag a rectangular portion of any white portion of the screen, then take the resulting screenshot and resize to 144 x 144. Finally, take "image A" from before, and copy and paste onto this white space. This usually creates a very nice icon.

Important note: If you happen to have the "Developer" menu item (e.g. at the very top of the screen, near "Bookmarks" and "Window") enabled in Safari preferences, make sure not to select "Clear Caches", or else this will delete all the icons you made too. Also, simply Clearing History does the same thing. Alternatively, if you really want to clear history or clear cache for more disk space, save the custom icons you created before you clear; that way you can put them back afterwards without having to create them again.

Caches can also be automatically cleared at times, so it is a good practice to create backups of icons.

Update: If you do not anticipate adding or removing websites to your Favorites list very often, you can lock the Images folder (~/Library/Safari/Touch Icons Cache/Images) to prevent your computer from overwriting or deleting the icons you just added. Right-click the folder, select Get Info, and then check the Locked button. Your Favorites icons should now be resistant to random overwrites by the system. Note that if you clear some history, you may notice that some icons seem to have disappeared: in this case, just Quit the Safari app (fully Quit the app – don't just close the windows) and your icons should be back to normal once you re-open Safari (as long as you locked the Images folder before clearing the history). In the future when you want to add another website to your Favorites list, you will want to unlock the Images folder before adding the website as a favorite. Then, after following the above steps to ensure the icon is to your liking, before Quitting the Safari app, re-lock the Images folder. Finally, as a precaution, I would recommend that you add a copy of the new icon to your backup.

  • 2
    I'd suggest to make backups of any icons that you make, since cache folders can be cleared at any time, sometimes by accident
    – Oion Akif
    Commented Aug 9, 2017 at 9:21
  • "Note that transparency causes trouble for safari favicons" Seems to work fine for me. Also seems to work for you, as per your Google Drive icon, right?
    – Oion Akif
    Commented Aug 9, 2017 at 9:30
  • 1
    Ah, good point Skeleton Bow, you are right about the Google Drive icon both having a transparent background and displaying fine. However, the reason I added that note is because my Economist icon had a red bar on "transparent" text, and at times was displaying the text as either white or black, the latter of which looks really strange. I had to put in a white background in order to get the text to display correctly. I slightly edited my answer to reflect the above.
    – xdavidliu
    Commented Aug 9, 2017 at 13:57
  • Thanks! But oh! I'm experiencing the problems you mentioned. I'm going to try to find out what exactly causes this transparency issue…
    – Oion Akif
    Commented Aug 13, 2017 at 16:28
  • The answer says "simply create another png that has the correct 144 x 144 resolution". How do I do this?
    – David W
    Commented Mar 26, 2020 at 14:21

A long-term fix would be to contact your website's publisher to add the correct icons appropriately.

For example, I own a website on Wix, and it's just a matter of adding a few lines of Header Code with links to my icon's image, then the site icon appears to work as expected. So it should be easy to convince your favorite publishers to add the icon.

  • I really don't think this is a viable solution: it is extremely doubtful that large sites like Gmail will pay me any attention if I emailed them asking them to fix some icons.
    – xdavidliu
    Commented Aug 3, 2020 at 3:51
  • @xdavidliu if enough people ask, they will prioritize it higher. Commented Nov 11, 2020 at 4:04

You must log in to answer this question.

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