Create this alias into your .aliases/.zshrc/.bashrc or where ever you store aliases for easier use later.

alias cpwd="pwd | tr -d '\n' | pbcopy && echo 'pwd copied to clipboard'"

See blog post for more details.

Copy Current Path