OSX: Set any password via terminal

To change minimum password length to 1

pwpolicy getaccountpolicies > temp.xml
nano temp.xml

Erase until first string is

<?xml version="1.0" encoding="UTF-8"?>

Find string

<string>policyAttributePassword matches '^$|.{1,}+'</string>

Replace {4,} with {1,}

<string>policyAttributePassword matches '^$|.{1,}+'</string>

Ctrl+O to save
Enter
Ctrl+X to exit

Apply changes and remove temp file

sudo pwpolicy setaccountpolicies temp.xml
rm temp.xml

Change password for current user

passwd