Flush DNS Cache

OS VersionCommand
macOS 12 (Monterey)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 11 (Big Sur)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.15 (Catalina)sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
macOS 10.14 (Mojave)sudo killall -HUP mDNSResponder
macOS 10.13 (High Sierra)sudo killall -HUP mDNSResponder
macOS 10.12 (Sierra)sudo killall -HUP mDNSResponder
OS X 10.11 (El Capitan)sudo killall -HUP mDNSResponder
OS X 10.10 (Yosemite)sudo discoveryutil udnsflushcaches
OS X 10.9 (Mavericks)sudo killall -HUP mDNSResponder
OS X 10.8 (Mountain Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.7 (Lion)sudo killall -HUP mDNSResponder
Mac OS X 10.6 (Snow Leopard)sudo dscacheutil -flushcache
Mac OS X 10.5 (Leopard)sudo lookupd -flushcache
Mac OS X 10.4 (Tiger)lookupd -flushcache
ipconfig /flushdns

Create bootable macOS install media

sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/UNTITLED

To avoid getting a ‘Installation Failed’ message, you need to change the date before installing :

date {month}{day}{hour}{minute}{year}

Set the Mac’s date to a date right around the time of release of the OS, e.g.

  • 10.7 : Mac OS X Lion was released on July 20, 2011.
  • 10.8 : OS X Mountain Lion was released on July 25, 2012.
  • 10.9 : OS X Mavericks was released on October 22, 2013.
  • 10.10 : OS X Yosemite was released on October 16, 2014.
  • 10.11 : OS X El Capitan was released on September 30, 2015.
  • 10.12 : macOS Sierra was released on September 20, 2016.
  • 10.13 : macOS High Sierra was released on September 25, 2017.
  • 10.14 : macOS Mojave was released on September 24, 2018.
  • 10.15 : macOS Catalina was released on October 7, 2019.
  • 11 : macOS Big Sur was released November 12, 2020.
  • 12 : macOS Monterey was released on October 25, 2021.

When creating an Intel install media on an ARM-based Mac, the OS expects the createinstallmedia executable to be signed before running, but the Apple-made program isn’t.
You’ll encounter a zsh : killed. error otherwise.
Sign the program with the following :

codesign -s - -f createinstallmedia

Prevent creation of .DS_Store files on network shares

One thing that can be problematic when working with any shared storage is the existence of .DS_Store files on the network share, since these are intended for a single workstation’s use.

Enabling a policy to prevent the creation of .DS_Store files on network shares can speed up directory browsing (as described in this article) and prevent permission errors when moving/deleting files.

To prevent the Mac workstation from creating .DS_Store files on network shares, as well as instruct it to ignore existing .DS_Stores, open Terminal and enter:

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE

and then log out/log in the macOS user account, or simply reboot the workstation.

To check the current policy in place, enter:

defaults read com.apple.desktopservices

If .DS_Store files are disallowed for network shares, “DSDontWriteNetworkStores = 1” should be displayed.

Note: To remove this policy and restore the default behavior, enter

defaults delete com.apple.desktopservices DSDontWriteNetworkStores

How to prevent the creation of .DS_Store files on network volumes

When working on network drives with Mac OS X every Mac user will by default create .DS_Store files. Those files are used by OS X to store custom attributes like icon positions. For more info on .DS_Store files read this article.

To prevent those files from being created:

  • Open up the Terminal
  • Run the following command
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
  • Restart your Mac or log out and back in.

Those .DS_Store files will now only be created on local volumes any you no longer have Windows users yelling at you about them. 😉