recent posts related to the mac os x operating system

What is the Mac OS X (macOS) fonts folder? (to add new fonts) alvin July 15, 2016 - 4:33pm

Apple/Mac FAQ: I want to add new fonts to my Mac, what is the Mac OS X (macOS) fonts folder?

Just put any new font files in the Library/Fonts folder under your home directory. For instance, my Mac OS X username is alvin, so the correct fonts folder is:

Applescript: How to open a PDF in Preview and go directly to a page alvin July 7, 2016 - 7:43pm

I’m currently generating my new book on “functional programming in Scala” as a PDF using a combination of Pandoc and LaTeX, and as a result it feels like I’m opening the same PDF file about 100 times a day.

How to jump to a screen location using a mouse click with iTerm2?

When using iTerm2, if you’re editing a file with vim and want to jump to a specific location in the file using a mouse click, just hold down the [Option] key when you do a normal left mouse click. That will take you to the location directly under the mouse cursor. (Unless the mouse cursor is beyond the end of the line. In that case the text cursor will be moved to the end of that line.)

I mention vim here because I just learned about this when using vim, but you should be able to use this with any app when using iTerm2. This is an iTerm2 feature (not a vim feature).

How to insert text with a custom TextMate Bundle snippet

As a quick note to self, I just created a TextMate Bundle snippet to insert some text at the current cursor position. Using TextMate 2.0.x, I did it with the following steps. I’ll go through these steps quickly as I’m just writing this for myself:

MacTex LaTeX installation path on macOS (pdflatex not found) alvin July 3, 2016 - 4:54pm

If you use MacTex to install pdflatex and all other LaTeX commands, as of mid-2016, the MacTex installation path is:


This means that the pdftex and pdflatex commands will be at /usr/texbin/pdflatex, and so on.

Simple iTunes AppleScript script examples alvin June 28, 2016 - 10:00am

If you’ve never used AppleScript, here are two iTunes AppleScript examples to get you going. First, This one tells iTunes to play the playlist named “My Favorites”:

tell application "iTunes"
    play playlist "My Favorites"
end tell

That script starts playing a random song from that playlist. If you want to start by playing the first song of that playlist, this script will do the trick:

Apple Magic Mouse 2 - How long to charge the battery?

I recently bought a new iMac, and it came with a “Magic Mouse 2,” which is like the original Magic Mouse, but this one has a built-in battery. (It would have been nice if the documentation mentioned that, but that’s another story.) Once I figured out that you could charge it, I quickly wondered, “How long do you need to charge the Magic Mouse 2?”

A Mac iTunes backup script (How I backup my iTunes music using find and tar)

Here’s a little one-liner I use to backup my iTunes music on my Mac OS X systems:

find . -name '*.mp3' -type f -mtime -365 -print0 | xargs -0 tar rvf ~/iTunesBackup.20150118.tar

The way this works is that I move into the Music folder on my OS X system, then run that command, and it creates the tar file shown at the end of the command. This command copies all *.mp3 files that are under the Music folder that have been modified in the last 365 days into the resulting tar file. If you have files other than MP3 files that you want to back up, or if you want to change the date range of the backup file created, just change (or remove) those options in the find command. Note that the -print0 option is needed to back up filenames and directories that contain blank spaces. (See my Unix/Linux find command examples for many more find command examples.)

Mac OS X FAQ: Where can I find the iLife sound effects?

Apple Mac OS X FAQ: Where can I find the iLife sound effects?

As of Mac OS X 10.10, the iLife sound effects are under this directory:

/Library/Audio/Apple Loops/Apple/iLife Sound Effects/

Under that directory you’ll find folders named Ambience, Animals, Booms, Foley, Jingles, Stingers, and many more. The sound effects/clips are under those folders.