MacOS – Permission denied error when copying to /usr/local/bin

macos

The GitHub setup page at https://help.github.com/articles/set-up-git has a section on password caching. It states to download the osxkeychain and copy it to /usr/local/bin. I downloaded the file, but get a permission denied error when I try to copy it to the directory specified. How can I get this file copied?

Best Answer

You will need to use sudo cp instead of just cp to copy a file to /usr/local/bin because /usr/* is only writable for root.