Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

Getting Permission Denied error while executing MacOS Homebrew command?

Homebrew error - Error Failure while executing cp pR private tmp d20220130

Are you getting below error while executing Homebrew command? Today while installing PHP on my new Macbook 16″ I got below error.

I tried below few tips but it didn’t work for me.

  • Execute same commands few times
  • Execute few more homebrew commands
  • Deleted all caches under /Library/Caches/Homebrew folder and retried

Check out at the bottom of this post for command which fixed my issue.


Here is a log which I got while installing PHP.

cp: /private/tmp/d20220130-43523-12rtj0a/apr/./1.7.0_2: unable to copy ACL to /usr/local/Cellar/apr/./1.7.0_2: Permission denied
cp: utimensat: /usr/local/Cellar/apr/.: Permission denied
Error: Failure while executing; `cp -pR /private/tmp/d20220130-43523-12rtj0a/apr/. /usr/local/Cellar/apr` exited with 1. Here's the output:
cp: /usr/local/Cellar/apr/./1.7.0_2: Permission denied
cp: /private/tmp/d20220130-43523-12rtj0a/apr/./1.7.0_2: unable to copy extended attributes to /usr/local/Cellar/apr/./1.7.0_2: Permission denied
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1: No such file or directory
cp: /private/tmp/d20220130-43523-12rtj0a/apr/./1.7.0_2/build-1: unable to copy extended attributes to /usr/local/Cellar/apr/./1.7.0_2/build-1: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1/libtool: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1/mkdir.sh: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1/make_exports.awk: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1/apr_rules.mk: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/build-1/make_var_export.awk: No such file or directory
cp: utimensat: /usr/local/Cellar/apr/./1.7.0_2/build-1: No such file or directory
cp: chown: /usr/local/Cellar/apr/./1.7.0_2/build-1: No such file or directory
cp: chmod: /usr/local/Cellar/apr/./1.7.0_2/build-1: No such file or directory

Here is some more log details. I’m not pasting complete error log but this is a tail end of the failure log.

cp: /usr/local/Cellar/apr/./1.7.0_2/lib/libapr-1.a: No such file or directory
cp: /usr/local/Cellar/apr/./1.7.0_2/lib/libapr-1.0.dylib: No such file or directory
cp: utimensat: /usr/local/Cellar/apr/./1.7.0_2/lib: No such file or directory
cp: chown: /usr/local/Cellar/apr/./1.7.0_2/lib: No such file or directory
cp: chmod: /usr/local/Cellar/apr/./1.7.0_2/lib: No such file or directory
cp: chflags: /usr/local/Cellar/apr/./1.7.0_2/lib: No such file or directory
cp: /private/tmp/d20220130-43523-12rtj0a/apr/./1.7.0_2/lib: unable to copy ACL to /usr/local/Cellar/apr/./1.7.0_2/lib: No such file or directory
cp: utimensat: /usr/local/Cellar/apr/./1.7.0_2: No such file or directory
cp: chown: /usr/local/Cellar/apr/./1.7.0_2: No such file or directory
cp: chmod: /usr/local/Cellar/apr/./1.7.0_2: No such file or directory
cp: chflags: /usr/local/Cellar/apr/./1.7.0_2: No such file or directory
cp: /private/tmp/d20220130-43523-12rtj0a/apr/./1.7.0_2: unable to copy ACL to /usr/local/Cellar/apr/./1.7.0_2: Permission denied
cp: utimensat: /usr/local/Cellar/apr/.: Permission denied
MacOS Terminal Homebrew Permission Denied Error cp utimensat usr local Cellar apr

How to fix above Permission Denied error while running Homebrew command on MacOS?

Step-1

  • Open Terminal.
  • Enter Command + Spacebar to open Spotlight.
  • Type Terminal to open Terminal application.
Open terminal on MacOS - Crunchify Tips

Step-2

Type below command.

Caches % sudo chown -R $(whoami) $(brew --prefix)/*

Here is a output:

You need to enter your password as you are executing this command as a root user.

bash-3.2$ sudo chown -R $(whoami) $(brew --prefix)/*
Password:
bash-3.2$

And you are all set. Try executing Homebrew command again and you shouldn’t see any permission issue any more.

Hope this helps. Let me know if you have any other suggestions.

The post Getting Permission Denied error while executing MacOS Homebrew command? appeared first on Crunchify.

Enregistrer un commentaire

0 Commentaires