- add the following script to your
bash_profile
alias lockscreen='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'- use
Alfredand just typelockin the search box - compiler the code and run
./lockscreen, please refer to here