macOS System Administration & Optimization#


Modify Known Hosts#

# Add description
nano ~/.ssh/known_hosts
# To remove a specific host
ssh-keygen -R 10.1.1.14
# Clear the full file
cat /dev/null > ~/.ssh/known_hosts

1. Disk Management & Diagnostics#

Identify and Verify Disks#

# List all physical and virtual disks
diskutil list
# Verify a specific disk (replace X with disk number)
diskutil verifyDisk /dev/diskX

SMART Monitoring (via Homebrew)#

# Install smartmontools
brew install smartmontools
# Check health of the primary NVMe drive
smartctl -a /dev/disk0

2. Homebrew Package Manager#

Official site: brew.sh

Installation#

/bin/bash -c "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh](https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh))"

Maintenance#

# List running background services
brew services list
# Update Homebrew and upgrade all packages
brew update && brew upgrade

3. Application Cleanup: Path Finder#

Brute Force Removal#

# Remove Application and Support files
sudo rm -rf /Applications/Path\ Finder.app/
sudo rm -rf ~/Library/Application\ Support/Path\ Finder/
sudo rm -rf ~/Library/Preferences/com.cocoatech.PathFinder.plist
sudo rm -rf ~/Library/Caches/com.cocoatech.PathFinder

Deactivate Updates#

defaults write com.cocoatech.PathFinder SUEnableAutomaticChecks NO

4. Permissions & Snapshots#

Remove Access Control Lists (ACL)#

# Recursively remove all ACL entries from a folder and its contents
chmod -RN /path/to/folder

Time Machine Local Snapshots#

# List all local snapshots
tmutil listlocalsnapshots /
# Delete a specific snapshot by date/ID
sudo tmutil deletelocalsnapshots 2025-12-29-030238
# Batch delete all com.apple.TimeMachine snapshots
for d in $(tmutil listlocalsnapshots / | grep 'com.apple.TimeMachine' | awk -F. '{print $4}'); do sudo tmutil deletelocalsnapshots $d; done

5. Time Machine: SMB Sparsebundle Resizing#

Use this workflow to effectively remove quotas from a network-based Time Machine backup.

# 1. Stop active backups
sudo tmutil stopbackup

# 2. Mount the SMB share manually
mkdir -p ~/SMB_TM
mount_smbfs //timemachine@UNAS-Pro/TimeMachine ~/SMB_TM

# 3. Resize the sparsebundle (e.g., to 10 Terabytes)
hdiutil resize -size 10t "~/SMB_TM/MacStudio (MO).sparsebundle"

# 4. Cleanup and Restart
umount ~/SMB_TM
rmdir ~/SMB_TM
sudo tmutil startbackup

6. Networking & File Transfers#

Flush DNS Cache#

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

Optimize SMB Speed (Disable Signing)#

echo "[default]" | sudo tee /etc/nsmb.conf && echo "signing_required=no" | sudo tee -a /etc/nsmb.conf

Remote File Transfers (SCP)#

# Upload specific images to Hugo project
scp -v /Users/marc/Downloads/to_convert/* root@10.1.2.202:/home/marc/hugo/inuvik/static/images/

SMB Shortcuts#

# Create a shortcut directory in Home for SMB Volumes
mkdir -p /Users/marc/SMBShares
ln -s /Volumes/Software /Users/marc/SMBShares/Software

7. Image Processing (Mogrify)#

Batch resize and optimize images for the web.

# Resize to 1200px width, strip metadata, and target 100kb size
mogrify -verbose \
  -path /Users/marc/Downloads/to_convert \
  -resize 1200x \
  -strip \
  -interlace Plane \
  -define jpeg:extent=100kb \
  /Users/marc/Downloads/to_convert/*.jpg

8. How to open the Developer Console#

On your Mac Studio, make sure Obsidian is the active window.

Press Cmd + Option + I (the letter ‘i’).

A side panel will open. Click the “Console” tab at the top of that panel.

9. Force nano to be used for crontab#

EDITOR=nano crontab -e

Make Nano the Permanent Crontab Editor on macOS#

Run these two commands in your Mac Terminal to stop macOS from defaulting to Vim:

1. Add the rule to your profile#

echo 'export EDITOR=nano' >> ~/.zshrc
# Apply
source ~/.zshrc

Verification#

From now on, you can simply type:

crontab -e

It will open in Nano every time without needing the prefix.

Troubleshooting#

If for some reason you are using an older version of macOS (pre-Catalina) and the above doesn’t work, you might be using Bash. In that case, run: echo 'export EDITOR=nano' >> ~/.bash_profile && source ~/.bash_profile


10. How to Enable Cron for Automated Syncing#

Locate the Hidden Cron Binary#

  1. Open System Settings > Privacy & Security > Full Disk Access.
  2. Click the [ + ] button at the bottom of the list.
  3. When the Finder window appears, press Cmd + Shift + G on your keyboard.
  4. In the box that appears, paste the following path exactly: /usr/sbin/cron
  5. Hit Enter. The cron file will be highlighted.
  6. Click Open.

Enable the Permission#

  1. Look for cron in the Full Disk Access list.
  2. Ensure the toggle switch is moved to the ON (Blue) position.
  3. (Optional) While in this menu, ensure Terminal is also toggled ON.

Step 3: Grant Network Volume Access (For SMB Shares)#

If your scripts or notes are stored on an SMB share (/Volumes/...):

  1. In the same Privacy & Security menu, click on Files and Folders.
  2. Find cron in that list.
  3. Ensure the toggle for Network Volumes is turned ON.