Software⏱️ 3 min read📅 2026-06-11

How to Fix: find command is giving error on Mountain Lion

Error fixing find command on Mountain Lion for mail folder list

Quick Answer: Use the -print0 option instead of -printf to fix the unknown primary or operator error.

The 'find' command is experiencing an error on Mountain Lion, preventing users from listing their mail folders as intended. This issue affects users who rely on custom .muttrc files to manage their email clients.

This error can be frustrating for users who have invested time and effort into creating complex .muttrc files. Fortunately, there are steps you can take to resolve this issue and achieve your desired results.

⚠️ Common Causes

  • The primary cause of this error is the incorrect use of the '-printf' option with the '-maxdepth' and '-type' options. The '-printf' option is used for printing files, but it's not compatible with the '-maxdepth' and '-type' options.
  • An alternative reason for this error could be due to a typo in the file path or incorrect usage of the command line arguments.

🚀 How to Resolve This Issue

Correcting the 'find' Command Syntax

  1. Step 1: To resolve this issue, you need to correct the syntax of the 'find' command. Replace the '-printf' option with a more suitable method for printing file names.
  2. Step 2: Use the '-print' option instead of '-printf'. This will print the names of files in the specified directory without any formatting options.
  3. Step 3: Update your .muttrc file to use the corrected syntax: `echo -n '+ '; find ~/.mail/fastmail -maxdepth 1 -type d -name '*.*' -print`

Using Alternative Methods for Printing File Names

  1. Step 1: If you're still experiencing issues after correcting the syntax, consider using alternative methods for printing file names.
  2. Step 2: You can use a shell script to achieve this. Create a new file (e.g., `print_files.sh`) with the following content: `for file in *.mail; do echo +'$file'; done`

🎯 Final Words

By correcting the 'find' command syntax and exploring alternative methods, you can successfully list your mail folders as intended. Remember to update your .muttrc file with the corrected syntax for optimal results.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions