Locking and Unlocking a file in macOS from the cli

To lock the file: chflags uchg {file path}

To unlock the file: chflags nouchg {file path}

Keywords: lock, unlock, command line, Terminal