Table of Contents
- macOS: crontab, launchd, and launchctl
- Running a simple command every minute with Mac launchd
- 1) Move to the $HOME/Library/LaunchAgents directory
- 2) Create a Mac plist file to describe your job
- 3) Tell MacOS about your Mac plist launchd file
- 4) How Mac launchd works with system reboots
- An important note about root and sudo access
- MacOS launchd, launchctl, and plist resources
- MacOS startup jobs: cron and crontab, launchd and launchctl
MacOS crontab FAQ: How do I run a Unix job (or shell script) through the MacOS crontab facility? I keep trying to edit my Mac crontab file, but my Mac won't save my crontab changes, or run my program.Back to top
macOS: crontab, launchd, and launchctl
Way back when (~2012-2014), I found that the Mac
crontab command was deprecated on MacOS, and the Apple documentation encouraged you to use their launchd facility. Here’s a blurb from Apple's
crontab man page:
“Darwin note: Although cron(8) and crontab(5) are officially supported under Darwin, their functionality has been absorbed into launchd(8), which provides a more flexible way of automatically executing commands. See launchctl(1) for more information.”
This is a decent article about how to start the Mac/MacOS screensaver using a keyboard shortcut (keystroke).
When I woke up last night it was a little windy outside, so I decided to unplug my MacBook Pro because the power tends to flicker here. When I picked up the MacBook I noticed that it was very warm, even though the lid was closed and it was in sleep mode. This morning I decided to dig into the “Why is my MacBook hot even though the lid is closed and it’s in sleep mode” question.
Here’s an example that shows how to find the largest files under a directory on MacOS and Linux/Unix systems.
A du/sort command to show the largest files under a directory on Mac OS X
The Unix/Linux command that worked for me on my MacOS system is this:
$ du -a * | sort -r -n | head -10
du is the disk usage command, and the
-a flag says, “Display an entry for each file in a file hierarchy.” Then I use the
sort command to sort the
du output numerically and in reverse. After that,
head -10 shows only the first ten lines of output. In the Music folder on my Mac the command and output look like this:
As a brief note about the Linux/Unix
sed command, today I learned how to append multiple lines of text to an HTML (or XML) file on macOS. The short answer is that I created a
sed commands file named changes.sed with these contents:
Mac Terminal FAQ: How can I change the title on the Mac Terminal app from the Mac/Unix command line?
I've been working on a project where I have three Mac Terminal tabs open at one time, and I found it was much easier to work this way when I changed the title on each Terminal window. This helped me easily identify what I was doing in each Terminal window.
Changing the Mac Terminal title
The basic escape sequence you need to change the Terminal title from the command line is this:
I was going to write a little application to let me annotate my MacOS screen during presentations, but the Ink2Go product looks like it does exactly what I was thinking. As I’m creating a video presentation, such as when showing how to write some Scala or Android code, I want to be able to draw on the screen, such as writing text, arrows, circles, and boxes to highlight parts of the screen. Ink2Go looks like what I want.
This is a good guide for things to be aware of when creating Mac/macOS applications using Java. It mostly includes a lot of information about the com.apple.eawt.AppEvent library/classes.
As a note to self, this apple.com Maintaining Your Signing Identities and Certificates page contains information on signing identities, certificates, provisioning profiles, developer accounts, developer id certficates, the keychain access app, exporting certificates, and more.