기타

brew 권한 문제 (Error: Permission denied)

초코민트냠냠 2024. 9. 10. 13:36
반응형

발생 문제 

brew upgrade와 brew cleanup을 할 때 권한 문제가 발생했습니다. clear이후로 왠지 모르게 출력이 날아가버렸는데 Certbot관련  디렉토리에 권한이 관리자로 되어 있었던 것 같습니다.

sudo brew upgrade, sudo brew cleanup

$ sudo brew cleanup
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

brew를 sudo로 실행하는 것은 더이상 지원하지 않는다고 합니다. 

brew 경로에 권한 부여

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

brew경로에 권한을 부여해서 sudo 없이도 접근 가능하게 해줍니다.

문제 해결

$ brew cleanup
...
Pruned 0 symbolic links and 8 directories from /opt/homebrew
==> This operation has freed approximately 150.5MB of disk space.

Certbot 설정을 하면서 경로의 권한이 바뀌어버린 것 같습니다. 앞으로 brew 권한 관련 문제는 이런 식으로 해결하면 될 것 같습니다.

반응형