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

19,875

Solution 1

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.

Solution 2

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

Solution 3

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.

Share:
19,875
user1118764
Author by

user1118764

Updated on June 04, 2022

Comments

  • user1118764
    user1118764 almost 2 years

    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?

  • xrisk
    xrisk over 6 years
    Please don't use chmod 777 mindlessly, it allows anybody on your computer to read your files!
  • shinxg
    shinxg over 6 years
    take it easy man, what we need to do is solve the access problem, if this solution can solve, why not use it.
  • Matthew Read
    Matthew Read over 5 years
    You can solve the access problem without introducing another access problem.