tinyapps.org / blog

Very slow copying LibreOffice.app from dmg to /Applications #

Copying LibreOffice.app's 771.4MB (13,307 files) from LibreOffice_6.0.2_MacOS_x86-64.dmg (235.9MB) into /Applications took over three minutes* on a MacBook Pro with a SSD and 16GB of RAM via Finder (rsync and cp were similarly sluggish).

By way of comparison, Android Studio.app's 846.9MB (10,720 files) copied from android-studio-ide-162.3871768-mac.dmg (445.8MB) via Finder in just fifteen seconds.

However, after zipping LibreOffice.app via OS X's built-in Compress command, it could be unzipped in less than twenty seconds via the default handler (Archive Utility). Why is copying from the dmg file so much slower? Perhaps The Document Foundation could offer a zip file rather than (or in addition to) the sluggardly dmg.

* (On first launch, there was another thirty second delay while "Verifying 'LibreOffice.app'..."; clear the quarantine attribute beforehand to avoid: xattr -d com.apple.quarantine /Applications/LibreOffice.app)



/mac | Mar 05, 2018

Archiving JavaScript-laden webpages #

Saving webpage assets wrapped in heavy JavaScript (e.g., lightboxes and slideshows) for offline access can be irksome.

Recently, a particularly recalcitrant website refused to fall to the usual suspects (Wget, SiteSucker, Offline Pages Pro, Chrome, Firefox, Safari, various extensions and add-ons, etc.), but incredibly came to heel under the venerable iCab's web archiving feature - thank you Alexander Clauss!

/mac | Feb 18, 2018

Quickly verify file checksums in OS X & macOS #

with Joss Brown's Checksums. Supports a wide array of algorithms, from built-ins like MD5 and SHA-256 to Tiger and Bencode via optional installs. Requires OS X 10.8 or higher.
  1. Download and mount latest DMG
  2. Copy Checksums.workflow to ~/Library/Services/
  3. If desired, automatic update checks can be disabled by opening Checksums.workflow in Automator and removing the updater function and function call from the bash script.
  4. Rather than using the Context menu to launch Checksums (Control-click > Services > Checksums), set a keyboard shortcut: System Preferences > Keyboard > Shortcuts > Services > File & Folders > Checksums > none > add shortcut > Control-Command-C (or any other desired and available key combination)
  5. To compare a checksum with a file, copy the checksum to the clipboard, select the file, and press your keyboard shortcut:

/mac | Feb 18, 2018

Add a macOS recovery partition without reinstalling macOS #

If you search the web for how to restore a missing recovery partition, chances are you'll come across advice like:
"Generally the best and simplest method is to reinstall OS X entirely. This is a neat way of triggering for a second time the process whereby the recovery partition is created. It's quite a drastic and time-consuming approach, however."
-- How to create a Mac recovery partition in OS X El Capitan and Yosemite
"The only way to solve this problem is to download the latest installer from App Store and re-install OS X"
-- How to re-create a missing recovery partition in OS X Yosemite (updated to OS X El Capitan)

However, thanks to davidjb's recovery.sh (detailed in his blog post Creating a macOS Recovery Partition without reinstalling OSX or re-running your installer), it is possible to add a recovery partition without reinstalling macOS.

Boot the Mac from an external drive or into Target Disk Mode*, then run:

TARGET="/Volumes/Macintosh HD"                                # Specify where to configure Recovery partition
MACOS_INSTALLER="/Applications/Install macOS Sierra.app"      # Path to your macOS installer

# Remaining paths ahead are dependent on OS version
# This *should* support 10.9 and above but is only tested on 10.12

curl http://support.apple.com/downloads/DL1464/en_US/RecoveryHDUpdate.dmg -L -o ~/Downloads/RecoveryHDUpdate.dmg

hdiutil mount -nobrowse ~/Downloads/RecoveryHDUpdate.dmg

pkgutil --expand /Volumes/Mac\ OS\ X\ Lion\ Recovery\ HD\ Update/RecoveryHDUpdate.pkg /tmp/recoveryupdate

hdiutil mount -nobrowse "$MACOS_INSTALLER/Contents/SharedSupport/InstallESD.dmg"

/tmp/recoveryupdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition "$TARGET" "/Volumes/OS X Install ESD/BaseSystem.dmg" 0 0 "/Volumes/OS X Install ESD/BaseSystem.chunklist"

hdiutil eject "/Volumes/Mac OS X Lion Recovery HD Update"

hdiutil eject "/Volumes/OS X Install ESD"


/mac | Feb 14, 2018

Remove all color but black from an image #

Background removal apps and web-based services don't do well with noisy images like this one of thin parchment paper which has text from the next page bleeding through:

Image of sheet music before removing background

However, ImageMagick works, well... magic: $ convert in.png -fill white -fuzz 80% +opaque "#000000" out.png

Image of sheet music after removing background

/nix | Feb 02, 2018

A scattering of dried figs and nuts #

Free from hindrance are those things which lie in the sphere of the moral purpose, and subject to hindrance are those which lie outside the sphere of the moral purpose. And so, if he regards his own good and advantage as residing in these things alone, in those, namely, which are free from hindrance and under his control, he will be free, serene, happy, unharmed, high-minded, reverent, giving thanks for all things to God, under no circumstances finding fault with anything that has happened, nor blaming anything; if, however, he regards his good and advantage as residing in externals and things outside the sphere of his moral purpose, he must needs be hindered and restrained, be a slave to those who have control over these things which he has admired and fears; he must needs be irreverent, forasmuch as he thinks that God is injuring him, and be unfair, always trying to secure for himself more than his share, and must needs be of an abject and mean spirit.

When a man has once grasped all this, what is there to prevent him from living with a light heart and an obedient disposition; with a gentle spirit awaiting anything that may yet befall, and enduring that which has already befallen? "Would you have me bear poverty?" Bring it on and you shall see what poverty is when it finds a good actor to play the part. "Would you have me hold office?" Bring it on. "Would you have me suffer deprivation of office?" Bring it on. "Well, and would you have me bear troubles?" Bring them on too. "Well, and exile?" Wherever I go it will be well with me, for here where I am it was well with me, not because of my location, but because of my judgements, and these I shall carry away with me; nor, indeed, can any man take these away from me, but they are the only things that are mine, and they cannot be taken away, and with the possession of them I am content, wherever I be and whatever I do. "But it is now time to die." Why say "die"? Make no tragic parade of the matter, but speak of it as it is: "It is now tune for the material of which you are constituted to be restored to those elements from which it came." And what is there terrible about that? What one of the things that make up the universe will be lost, what novel or unreasonable thing will have taken place? Is it for this that the tyrant inspires fear? Is it because of this that his guards seem to have long and sharp swords? Let others see to that; I have considered all this, no one has authority over me. I have been set free by God, I know His commands, no one has power any longer to make a slave of me, I have the right kind of emancipator, and the right kind of judges. "Am I not master of your body?" Very well, what is that to me? "Am I not master of your paltry property?" Very well, what is that to me? "Am I not master of exile or bonds?" Again I yield up to you all these things and my whole paltry body itself, whenever you will. Do make trial of your power, and you will find out how far it extends.

Who is there, then, that I can any longer be afraid of? Shall I be afraid of the chamberlains? For fear they do what? Lock the door in my face? If they find me wanting to enter, let them lock the door in my face!—Why, then, do you go to the gate of the palace?—Because I think it fitting for me to join in the game while the game lasts.—How, then, is it that you are not locked out?—Because, if anyone will not receive me, I do not care to go in, but always I wish rather the thing which takes place. For I regard God's will as better than my will. I shall attach myself to Him as a servant and follower, my choice is one with His, my desire one with His, in a word, my will is one with His will. No door is locked in my face, but rather in the face of those who would force themselves in. Why, then, do I not force myself in? Why, because I know that within nothing good is distributed among those who have entered. But when I hear someone called blessed, because he is being honoured by Caesar, I say, "What is his portion? Does he, then, get also a judgement such as he ought to have for governing a province? Does he, then, get also the ability to administer a procuratorship? Why should I any longer push my way in? Somebody is scattering dried figs and nuts; the children snatch them up and fight with one another, the men do not, for they count this a small matter. But if somebody throws potsherds around, not even the children snatch them up. Governorships are being passed around. The children shall see to that. Money. The children shall see to that. A praetorship, a consulship. Let the children snatch them up; let the children have the door locked in their faces, take a beating, kiss the hands of the giver, and the hands of his slaves. As for me, it's a mere scattering of dried figs and nuts." But what, then, if, when the man is throwing them about, a dried fig chances to fall into my lap? I take it up and eat it. For I may properly value even a dried fig as much as that. But neither a dried fig, nor any other of the things not good, which the philosophers have persuaded me not to think good, is of sufficient value to warrant my grovelling and upsetting someone else, or being upset by him, or flattering those who have flung the dried figs among us.

Excerpt from Chapter VII, Of freedom from fear, in Book IV of Epictetus' Discourses.

/misc | Dec 11, 2017

whois terminal command not returning registrant contact info #

At some point in recent history, whois stopped returning registrant contact info for a number of TLDs, including .com*. In Why is 'whois' showing no registrant information?, bu11etpr00f explains that the specific registrar whois server must now be queried directly in order to get registrant contact information, i.e.,

$ whois reddit.com
Registrar WHOIS Server: whois.markmonitor.com
$ whois -h whois.markmonitor.com reddit.com
Registrant Name: Domain Administrator
Registrant Organization: Reddit Inc.
Registrant Street: 548 Market St.,

Rather than running two commands, I cobbled together this oneliner:

$ whois -h $(whois reddit.com | grep 'Registrar WHOIS Server:' | cut -f2- -d:) reddit.com

but quickly realized that I use whois often enough to create a bash function for it.

So I saved this in ~/.bash_profile:

function w2 {
  whois -h $(whois $1 | grep 'Registrar WHOIS Server:' | cut -f2- -d:) $1

then ran source ~/.bash_profile to reload.

Much easier now:

$ w2 reddit.com
Registrant Name: Domain Administrator
Registrant Organization: Reddit Inc.
Registrant Street: 548 Market St.,

* Thanks to Guy at easyDNS for kindly informing me of the difference between thick and thin WHOIS registries. See also Anthony Geoghegan's reply to Why do some domain names have extremely truncated whois information? for more information.

/nix | Nov 14, 2017

Demi-decennial coworking update* #

WeWork "transforms buildings into beautiful, collaborative workspaces." 237 buildings in 56 cities, for teams of 1 to 500+.

Previously: 2005, 2010

*Yes, this installment is running slightly behind schedule.

/misc | Oct 26, 2017

Windows 10: Restore classic blue solid color Desktop background #

In Windows 2000 and XP, the default solid color Desktop background was a serene shade of blue:

Windows 2000 and XP blue solid color Desktop background

Hue: 141
Sat: 115
Lum: 105


Red: 58
Grn: 110
Blu: 165


Hex: #3A6EA5

The "Windows Classic" theme in Windows 7 used the same color, but there was a slightly darker blue default color available in the Solid Colors menu, which was still available in Windows 8.1:

Windows 7 and 8.1 blue solid color Desktop background

Hue: 142
Sat: 203
Lum: 60


Red: 10
Grn: 59
Blu: 118


Hex: #0A3B76

Inexplicably, Windows 10 not only removed these calming blue tones and replaced them with 24 largely garish colors, but also failed to provide any option for customizing colors in the main Settings menu (right click Desktop > Personalize > Background: Solid Color). Happily, the classic Desktop Background applet is accessible via Run > control /name Microsoft.Personalization /page pageWallpaper. Not only can you select the Windows 7 darker blue, but you can also create custom colors by clicking "More...".

UPDATE: The day after this post, Microsoft released Windows 10 Fall Creators Update, which includes a "Custom color" option in the main Background settings window. Click "More" to enter RGB, HSV, or hex values.

/windows | Oct 16, 2017

macOS: Export Contacts to CSV #

While Contacts.app does not include an explicit CSV export option, one can be easily effected by:
  1. highlighting desired contacts,
  2. dragging them into a new Numbers spreadsheet, and
  3. exporting the spreadsheet to CSV

/mac | Oct 16, 2017

Subscribe or visit the archives