mkdir/cp in Mac terminal gives "Permission denied" error

Viewed 21592

I'm trying to copy a directory in terminal from the Downloads directory to a sub-directory within the Applications/ directory, and I keep getting "Permission denied" error. Why is this so?

3 Answers

try ls -lt

to see access permission of the folder you want copy file into

then use chmod 777 your_folder_name to change the access permissions of the folder

If you "right-click -> Get info" the Applications folder you will notice that the permissions for the Applications folder are Read/Write for 'system' or 'admin'. For 'everyone' it's Read-only. If you are not an admin you need to use 'sudo cp -R Downloads/___Test /Applications'. Obviously, you need to enter a password.

MacOS prevents interaction with downloaded files until you confirm that they are safe. You can effectively do this programmatically by running:

xattr -d com.apple.quarantine ~/Downloads/your_file_here

Then you should be able to copy the file.

Related