⚠️ This is an old post.

Content may be out of date.

You can re-run the macOS Setup Assistant on the next boot by removing the .AppleSetupDone file:

rm /var/db/.AppleSetupDone

Gist on GitHub