Keep Track of Defaults Write Commands on Mac OS Automatically

Learn how to automatically keep track of defaults write commands used on Mac OS X and easily manage and monitor changes to default settings. This guide will show you a simple method to create a text file that logs all the default commands executed on your Mac.

If you frequently use default commands and struggle to remember which ones are enabled or disabled, or if you want to have a complete list of all default changes made on your Mac, this tutorial is for you.

By following the steps outlined in this guide, you can create a separate file that records every default script executed, making it convenient to review and reference all the changes made. Additionally, this method ensures that the default list is not affected even if the command history is cleared.

How to Automatically Track Defaults Write Commands on Mac OS

To get started, open Terminal and follow these steps:

  1. Use the command line text editor (e.g., nano) to open the .bash_profile file:
  2. nano ~/.bash_profile

  3. Insert the following string on a new line in the .bash_profile file:
  4. PROMPT_COMMAND='echo "$(history 1 | grep "defaults")" | sed '/^$/d' >> ~/Documents/defaults.txt'

    Note: The default location for the defaults list file is the user’s home directory (~) in a file named defaults.txt. You can change this if desired.

  5. Save the document by pressing Control + O and exit nano by pressing Control + X.

A new document named defaults.txt will be created the first time the string “defaults” is detected in a command execution. Each subsequent default entry will be added as a numbered list item on its own line.

Advantages of This Method

Tracking default commands using this method offers several benefits:

  • The default list file is separate from the general command history, ensuring its availability even if the command history is cleared.
  • All default commands, including read and delete operations, are captured in the default list.
  • The list can be easily viewed and edited using any text editor.


1. What are the supported devices for this guide?

This guide is applicable to Apple devices only.

2. What are the supported operating systems?

This guide is specifically for Mac OS (macOS) and iOS.

Editorial Staff
Editorial Staff
The Bollyinside editorial staff is made up of tech experts with more than 10 years of experience Led by Sumit Chauhan. We started in 2014 and now Bollyinside is a leading tech resource, offering everything from product reviews and tech guides to marketing tips. Think of us as your go-to tech encyclopedia!


Please enter your comment!
Please enter your name here

Related Articles

Best Telemedicine Software: for your healthcare practice

Telemedicine software has transformed my healthcare visits. It's fantastic for patients and doctors since they can obtain aid quickly. I...
Read more
I love microlearning Platforms in today's fast-paced world. Short, focused teachings that engage me are key. Microlearning platforms are great...
Think of a notebook on your computer or tablet that can be changed to fit whatever you want to write...
As of late, Homeschool Apps has gained a lot of popularity, which means that an increasing number of...
From what I've seen, HelpDesk software is essential for modern businesses to run easily. It's especially useful for improving customer...
For all of our important pictures, stories, and drawings, Google Drive is like a big toy box. But sometimes the...