os x

How to copy text from the MacOS Terminal to the clipboard

If you ever need to copy text (or a text file) from the MacOS Terminal to the Mac clipboard, I can confirm that the macOS pbcopy command works. It reads from STDIN and copies the text to the clipboard, so commands like these work:

$ echo "foo bar baz" | pbcopy

$ cat /etc/passwd | pbcopy

How to replace newline character with sed on Mac OS X (macOS)

I don’t have much time to explain this today, but ... if you want to see how to use the sed command on a Mac OS X (macOS) system to search for newline characters in the input pattern and replace them with something else in the replacement pattern, this example might point you in the right direction.

Apple has an iOS/macOS “Stagefright” security flaw alvin July 21, 2016 - 6:12pm

According to Forbes and other sources, Apple now has its own version of a “Stagefright” security flaw, and it affects all but the most recent versions of iOS and Mac OS X. Theoretically all it requires is that a hacker sends your phone one text.

Apple’s minimalist security announcements are here: iOS 9.3.3 update, OS X update.

Monodraw, an ASCII art drawing app for Max OS X alvin March 5, 2016 - 11:56am

This weekend I’ll be giving Monodraw a test drive. It’s an ASCII-art drawing program for Mac OS X. If it’s as good as advertised I may use it to draw images for my new book.

How to show the largest files under a directory on Mac OS X (Unix)

I haven’t solved my overall problem yet — which is how to fit 64 GB of music onto a tablet with 24GB free space — but I did solve another problem today: How to show the largest files under a directory on Mac OS X (and Unix systems). In this short tutorial I’ll demonstrate what I learned.

A command to show the largest files under a directory on Mac OS X

The Unix command that worked for me on my Mac OS X system is this:

Using sed to add a newline on Mac OS X

As a quick note today, I have been converting parts of the Scala Cookbook from a plain text format to a Markdown format, and as part of that I needed to add some newline characters to add spacing to the document. This wouldn’t be bad if it was a few pages, but it’s hundreds of pages, so I decided to use the Unix sed command to do the work.

How to kill/disable the Dashboard in Mac OS X 10.9

OS X 10.9 is sucking the life out of my old Mac, a 2008 iMac. Like turning off everything on Star Trek’s Enterprise so you can give power to something else (like the engines or shields), I keep looking for ways to bring a little life back to it. One way I’ve read about is to kill the Dashboard on 10.9.

You can kill the Dashboard with this Mac OSX defaults command, issued in a Mac Terminal window:

The Mac OS X (macOS) "won't shutdown" (slow shutdown) problem

Since upgrading to Mac OS X 10.9 I’ve experienced the problem other people have reported, where their Mac won’t shutdown, or shuts down very slowly. We had a huge lightning storm roll in a few days ago, and when my 2008 iMac didn’t shut down after three minutes of waiting, I finally had to press and hold the button on the back to force it to shut down.

Since then I’m glad to say that the following series of defaults write commands has helped my iMac to shut down much more quickly: