If you want to change the password of the current user that you are logged into the Mac using Terminal then you can make use of the security set-keychain-password command.
Steps to Change Current User Password Using Mac Terminal:
- Open Terminal App,
- Now type the command: security set-keychain-password
- Enter the old password.
- Enter new password.
- Re-Enter new password.

% security set-keychain-password
Old Password:
New Password:
Retype New Password:
Note: The command sudo passwd <user-name> will not work to change the current user password, you would see this warning.
% sudo passwd code2care
Password:
Changing password for code2care.
Old password:
New password:
################################### WARNING ###################################
# This tool does not update the login keychain password. #
# To update it, run `security set-keychain-password` as the user in question, #
# or as root providing a path to such user's login keychain. #
###############################################################################
-
Facing issues? Have Questions? Post them here! I am happy to answer!
More Posts related to MacOS,
- Clear Screen shortcut macOS Terminal
- What is macOS Ventura?
- [fix] How to Show file extensions on all files on Mac
- How to Find Where Mac Terminal App is Located?
- AutoSave button not working on Office on Mac (Word, Excel or Powerpoint)
- macOS say command text to speech using various voices and languages
- How to change Ping TTL value on macOS
- Open .bash_profile File in TextEdit using Terminal
- How to know the Safari Version on Mac
- How to Copy full Absolute Path of a File on Mac
- 13.0 MacOS Ventura release date
- Enable spell check in Sublime Text (macOS)
- How to Display Analog Clock on Mac Menu Bar
- How to turn off Location Services macOS Ventura 13
- How to Open VS Code on Mac
- Add Bookmark macOS Safari
- How to Fix cd: too many arguments Error in Terminal: A Step-by-Step Guide
- How to install wget on macOS
- Select Line Number TextEdit on Mac
- Strikethrough Text in Excel for Mac
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to hide or display Wifi icon in macOS Bug Sur Menu Bar
- How to install Yarn on Mac (macOS)
- How to fix command not found brew (bash, zsh) on macOS Terminal
- How to Schedule Mails in macOS Ventura
More Posts:
- How to Transpose a Square Matrix - Java Program - Java
- How to Run all Cells at Once Jupyter Notebook - Python
- How to verify if java is installed on the computer and get version detail - Java
- Queue Implementation in Java with Examples - Java
- How to copy Chrome alert popup text to clipboard - Chrome
- CSS: Apply opacity only for div background and not text - CSS
- Advanced ways to set Custom Settings for a Website on Safari for Mac - MacOS
- Resolve System.IO.PathTooLongException [Sharepoint C# .Net] - SharePoint