mac-os-x

recent posts related to the mac os x operating system

How to get MacOS Message app to sync up with iPhone messages (get it to update)

As a quick note, I often have a problem where the Messages app on MacOS (formerly Mac OS X) won’t update to receive new messages. By this I mean that I receive messages on my iPhone, but then when I go to my Mac and open the Messages app, my new text messages either never get there, or it takes a long time for them to show up in the Messages app.

MacOS softwareupdate command (how to ignore updates)

I just learned that MacOS has a softwareupdate command, and further learned that it has a --ignore option, which may or may not let you ignore useless updates. For example, my Mac prompts me daily to update Keynote, Numbers, and Pages, which I rarely (rarely!) use, so I don’t want to bother updating them. I’m hoping the a softwareupdate command will help me with this.

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.

How to fire Mac OS X notifications with AppleScript (and Scala)

Summary: This tutorial demonstrates how to fire MacOS system notifications with AppleScript (and Scala or Java).

In this article I assume that you already know at least a little bit about how to use AppleScript, and just want to know how to trigger a MacOS notification. At the end of the tutorial I show how to invoke the AppleScript code using Scala and Java.

Unix: How to find files with multiple filename extensions

As I mentioned in my How to find multiple filenames with Linux find tutorial, you can use find command syntax like this to find files with multiple filename extensions:

find iTunes \( -name "*.mp3" -o -name "*.m4a" \)

As that command shows, I ran this find command to find all of my music files under my iTunes directory, including .mp3 and .m4a filename extensions.

While I’m in the neighborhood, this is the full find command I use to backup all of my iTunes files that have changed or been added in the last 180 days:

find iTunes \( -name "*.mp3" -o -name "*.m4a" \) -type f -mtime -180 -print0 | xargs -0 tar rvf NewMusic.tar

There’s probably an easier way to do this, but that backup command works for me.

Two more Textmate commands (capitalize, CSV to list)

As a “note to self,” I wrote two more Textmate commands yesterday, one to capitalize each word in a selection of words, and another to convert a CSV list of words to a simple list. Here’s the source code for the Capitalize command:

#!/bin/sh

perl -ne 'print ucfirst $_'

The $_ portion of that Perl command isn’t required, but I include it as a reminder to myself about how Textmate commands and snippets work.

Here’s the source code for my Textmate command that uses the Unix tr command to convert a CSV list of words (such as a paragraph of comma-separated words) into a simple list of words:

#!/bin/sh

tr , "\n"

As you can see, those commands are fairly simple. If you know Unix/Linux and then know a little about how to write Textmate commands, you can usually get it to do what you want. I like that you can use any Mac/Unix programming language or tool to solve the problem at hand.

How to set the Java version on Mac OS X (macOS) systems

I don’t remember where I first found this line of code, but if you put it in your Mac OS X ~/.bash_profile file, it’s an easy way to set your Mac Java version:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

I can confirm this works with the Bash shell on Mac OS X 10.10. When I run the java -version command after opening a new Mac Terminal window, the output is 1.8.0_25.

A slightly more difficult way to set your Mac Java version is to look under the /Library/Java/JavaVirtualMachines directory to see which versions are installed, and then manually set the version.

What is the Mac OS X (macOS) fonts folder? (to add new fonts)

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: