Table of contents
  1. Software Update
    1. How do I apply all recommended updates?
    2. Updating Mac using the Terminal app
    3. Install all but make sure you ignore ‘JavaForOSX’ updates:
    4. To clear the list, ignored updates, enter:
    5. Update/Install OS
      1. This gives you a list of available releases you can choose from. Once downloaded it will be saved in your Applications folder
        1. Munki’s InstallInstallMacOS utility
      2. create installer
        1. run
  2. dscl
    1. unhide a user account
  3. chflags
    1. Hide Home folder
  4. DISKUTIL
    1. find disk
    2. unmount
    3. force unmount
    4. Format drive/Volume
    5. Diskutil SecureErase
  5. csrutil
  6. pwpolicy
    1. Set Global Policy




Software Update

All updates that are recommended for your system:

sudo softwareupdate -r

Updating Mac using the Terminal app

To install all updates that are applicable to your system, enter:

sudo softwareupdate -i -a

Install all but make sure you ignore ‘JavaForOSX’ updates:

sudo softwareupdate --ignore JavaForOSX

To clear the list, ignored updates, enter:

sudo softwareupdate --reset-ignored

Update/Install OS

This gives you a list of available releases you can choose from. Once downloaded it will be saved in your Applications folder

softwareupdate --list-full-installers;echo;echo "Please enter version number you wish to download:";read;$(if [ -n "$REPLY" ]; then; echo "softwareupdate --fetch-full-installer --full-installer-version "$REPLY; fi);

Munki’s InstallInstallMacOS utility

Once finished, you’ll find in your ~/macOS-Installer/

mkdir -p ~/macOS-installer && cd ~/macOS-installer && curl https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py > installinstallmacos.py && sudo python installinstallmacos.py

create installer

run

createinstallmedia command provided by Apple (opens a new window). Note that the command is made for USB’s formatted with the name MyVolume:

sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume

Note for users on Apple Silicon installing macOS older than Big Sur
If the createinstallmedia fails with zsh: killed or Killed: 9 then it’s most likely an issue with the installer’s code signature.
To fix this, you can run the following command:

cd /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/
codesign -s - -f --deep /Applications/Install\ macOS\ Big\ Sur.app

You will need the command line tools for Xcode installed:

xcode-select --install

dscl

unhide a user account

sudo dscl . create /Users/hiddenuser IsHidden 0

chflags

Hide Home folder

sudo chflags hidden /Users/username

DISKUTIL

find disk

diskutil list

unmount

diskutil unmountDisk /dev/disk#

force unmount

diskutil unmountDisk /force /dev/disk#

Format drive/Volume

diskutil eraseDisk

Usage: diskutil eraseDisk format name [APM[Format]|MBR[Format]|GPT[Format]]MountPoint|DiskIdentifier|DeviceNode

Completely erase an existing whole disk.
All volumes on this disk will be destroyed.
Ownership of the affected disk is required.
Format is the specific file system name you want to erase it as (HFS+, etc.).
Name is the (new) volume name (subject to file system naming restrictions),
or can be specified as %noformat% to skip initialization (newfs).
You cannot erase the boot disk.

 diskutil eraseDisk JHFS+ UntitledUFS disk3
diskutil eraseDisk JHFS+ CleanDrive /dev/disk1

Formats

APFS: Allocates disk space within a container (partition) on demand.
When a single APFS container has multiple volumes, the container’s free space is shared and is automatically allocated
to any of the individual volumes as needed.
If desired, you can specify reserve and quota sizes for each volume.
Each volume uses only part of the overall container, so the available space is the
total size of the container, minus the size of all the volumes in the container.

APFS: Uses the APFS format. Choose this option if you don’t need an encrypted or case-sensitive format.

APFS (Encrypted): Uses the APFS format and encrypts the volume.

APFS (Case-sensitive): Uses the APFS format and is case-sensitive to file and folder names. For example, folders named “Homework” and “HOMEWORK”
are two different folders.

APFS (Case-sensitive, Encrypted): Uses the APFS format, is case-sensitive to file and folder names, and encrypts the volume.
For example, folders named “Homework” and “HOMEWORK” are two
different folders.

File SystemAbbreviation ——————————————–—– Mac OS Extended (Journaled)JHFS+ Mac OS
ExtendedHFS+ MS-DOS fat32FAT32 ExFATExFAT     

Diskutil SecureErase

Now we need to select the level of secure erase we want. There are five levels of secure erasing you can use labeled from 0-4.

Level 0 just erases the drive by writing the number zero across every sector of the drive.

Level 1 does the same but with random data, thus taking longer.

Level 2 erases the drive 7 times with 1’s and 0’s except the last pass where it uses random data.

Level 3 is a special algorithm that erases the drives with random data as well as data compiled from a special collection of 1’s and 0’s.

Level 4 is a little different and erases it three times, with random data on the first two passes and one set of zeroes on the last pass.

diskutil secureErase 4 /dev/disk2

csrutil

pwpolicy

Set Global Policy

pwpolicy -setglobalpolicy minChars=0