tinyapps.org / blog


Reset Safari 10 in OS X 10.11 El Capitan #

Turn this:

Safari junk

into this:

Safari clean

#!/bin/bash

# Reset Safari 10 for current user. Developed and tested under OS X 10.11.6 El Capitan.

# Backup bookmarks to Desktop, exiting if unsuccessful

cp -v ~/Library/Safari/Bookmarks.plist ~/Desktop/Bookmarks-`date +%Y%m%d%H%M%S`.plist
if [[ $? -ne 0 ]]; then
    exit 1
fi

# Delete main Safari data directory
rm -rfv ~/Library/Safari

# Delete caches
rm -rfv ~/Library/Caches/com.apple.Safari
rm -rfv ~/Library/Caches/com.apple.Safari.SearchHelper
rm -rfv ~/Library/Caches/com.apple.safaridavclient
rm -rfv ~/Library/Caches/com.apple.WebKit.PluginProcess
rm -rfv ~/Library/Caches/Metadata/Safari
rm -rfv ~/Library/Caches/SafariNotificationAgent
rm -rfv ~/Library/Caches/com.apple.commerce.safari/SafariLibrary

# Delete cookies
rm -rfv ~/Library/Cookies/Cookies.binarycookies
rm -rfv ~/Library/Cookies/com.apple.safari.cookies
rm -rfv ~/Library/Cookies/com.apple.CaptiveNetworkAssistant.binarycookies
rm -rfv ~/Library/Cookies/com.apple.Safari.SafeBrowsing.binarycookies
rm -rfv ~/Library/Cookies/com.apple.Safari.SearchHelper.binarycookies

# Delete preferences
rm -rfv ~/Library/Preferences/com.apple.Safari.LSSharedFileList.plist
rm -rfv ~/Library/Preferences/com.apple.Safari.RSS.plist
rm -rfv ~/Library/Preferences/com.apple.Safari.plist
rm -rfv ~/Library/Preferences/com.apple.Safari.Extensions.plist
rm -rfv ~/Library/Preferences/com.apple.WebFoundation.plist
rm -rfv ~/Library/Preferences/com.apple.WebKit.PluginHost.plist
rm -rfv ~/Library/Preferences/com.apple.WebKit.PluginProcess.plist
rm -rfv ~/Library/Preferences/com.apple.commerce.safari.plist

# Delete saved state
rm -rfv ~/Library/Saved\ Application\ State/com.apple.Safari.savedState

# Delete RSS feeds subscribed in Safari or Mail
# More info on PubSub database and command:
# http://krypted.com/mac-os-x/managing-mail-and-safari-rss-subscriptions-from-the-command-line/
rm -rfv ~/Library/PubSub/Database

# Delete yet more Safari data (cannot find any definitive documentation on this directory)
rm -rfv ~/Library/WebKit/com.apple.Safari

# Delete SharedFileList
rm -rfv ~/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.apple.safari.sfl

# Delete LSOs / Flash cookies
rm -rfv ~/Library/Caches/Adobe/Flash\ Player

# Clear download history from all browsers, including Safari
# More info: http://osxdaily.com/2012/07/12/list-download-history-mac-os-x/
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'

# Delete QuickTime cache
rm -rfv ~/Library/Caches/QuickTime

# You may wish to check /Library/Internet\ Plug-Ins/ and ~/Library/Internet\ Plug-Ins/
# for any plugins other than the default Quartz Composer.webplugin and Default Browser.plugin.

Sources:

  1. Testing with fs_usage and File Buddy in a clean VM.
  2. completely reset Safari 9
  3. How to reset safari 9.0.3
  4. Reset Safari from command line
  5. Reset Safari doesn't really clean all the cookies of Safari web browser
  6. History in Safari
  7. Aborting a shell script if any command returns a non-zero value?
  8. In a bash script, how can I exit the entire script if a certain condition occurs?

/mac | Feb 11, 2017

Still using Yahoo Mail? #

/misc | Feb 10, 2017

List all files on disk #

Even as root, ls and find produced too many errors ("Permission denied", "Not a directory", "directory causes a cycle", "Input/output error", etc) when attempting to list all files on disk. Tree worked a treat:

$ tree -a -i -f / > filesystemlist.txt

 -a All files are listed.
 -i Don't print indentation lines.
 -f Print the full path prefix for each file.
See also Tree for Windows and LINUX Recursively list all files in a directory including files in symlink directories.

/nix | Feb 06, 2017

Migrating from Mail.app to Thunderbird #

/mac | Feb 05, 2017

Batch remove all tiles from Windows 10 Start Menu #

Well, almost all tiles; the few that remain after running the script below (save as unpin.ps1 then right click and "Run with PowerShell") can be removed manually (right click tile > "Unpin from Start").

/windows | Feb 04, 2017

Convert asciidoc to markdown #

  1. Install pandoc and asciidoc

    $ sudo apt install pandoc asciidoc

  2. Convert asciidoc to docbook

    $ asciidoc -b docbook foo.adoc

    foo.xml will be output into the same directory as foo.adoc

  3. Convert docbook to markdown

    $ pandoc -f docbook -t markdown_strict foo.xml -o foo.md

  4. Unicode symbols were mangled in foo.md. Quick workaround:

    $ iconv -t utf-8 foo.xml | pandoc -f docbook -t markdown_strict | iconv -f utf-8 > foo.md

  5. Pandoc inserted hard line breaks at 80 characters. Removed like so:

    $ iconv -t utf-8 foo.xml | pandoc -f docbook -t markdown_strict --wrap=none | iconv -f utf-8 > foo.md

/nix | Jan 24, 2017

3 Mac file-related apps #

from a blog post (and related comments) on Robservatory:

/mac | Jan 23, 2017

Objections to veganism #

Vegan Sidekick has a handy guide to justifications for harming and exploiting animals. TL;DR: this comic covers much of it.

/misc | Jan 23, 2017

Direct download of Boot Camp drivers #

  1. From within Windows (or OS X) via Timothy Sutton's Brigadier Python script
  2. From within OS X via Boot Camp Assistant > Action > Download Windows Support Software
  3. From within a browser (for Windows 7/Boot Camp 4 & 5.1) via this Apple page

/mac | Dec 10, 2016

Cloning 1TB MBR system HDD to 4TB GPT SSD #

  1. Install 4TB SSD
  2. Change boot mode to UEFI and SATA operation to AHCI.* For example, on a typical Dell system:
  3. Boot from Acronis True Image 2016 disc (be sure to select entry under UEFI BOOT, not LEGACY BOOT)
  4. Clone 1TB MBR HDD to 4TB GPT SSD. MBR will be converted to GPT automatically on destination disk

Received "Failed to write data to disk" error at end of cloning process followed shortly by "Cloning succeeded".

On reboot, the following message appeared:

 

Windows Boot Manager

Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:

1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and then click "Next."
3. Click "Repair your computer."

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.

File: \EFI\Microsoft\Boot\BCD

Status: OxcOOOOOOf

Info: An error occurred while attempting to read the boot configuration data.

ENTER=Continue ESC=Exit

 

  1. Booted from Windows 7 install disc (again, be sure to select device under UEFI BOOT, not LEGACY BOOT)
  2. Next > Repair your computer
  3. "Windows found problems with your computer's startup options. Do you want to apply repairs and restart your computer?"
  4. Before clicking "Repair and restart", clicked "View details", which revealed:
        The following startup options will be added:
        Name: Windows 7 Professional (recovered)
        Path: Windows
        Windows Device: Partition=D: (3815116 MB)

Windows booted normally from 4TB SSD.

* IDE/ATA was required in this account, which uses a method similar to Xcopy Windows to a new hard drive, but with ntfsclone (careful with syntax - the target is specified before the source, as explained in the man page:
Clone NTFS on /dev/hda1 to /dev/hdc1:
ntfsclone --overwrite /dev/hdc1 /dev/hda1
)
Destination disk is larger than 2 TB: If "My source disk is MBR and my OS supports UEFI" and "My system is UEFI-booted (Windows or Acronis Bootable Media)" then "partition style on your destination disk will be converted to GPT automatically. This disk may be used for booting in UEFI. Also, the entire disk space will be available."

/windows | Dec 03, 2016


Subscribe or visit the archives