본문 바로가기
프로그래밍/database

[Error ]Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving allbuild scripts full access to your system. 해결방법

by 한코코 2022. 8. 11.

어제부터 mysql 접속이 안된다.

ERROR 2002 (HY000) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.socket' (2)

 

이게 뜨는데 다른걸 확인하려고 홈브류에 접속하려고하면 접속못한다고 다음과 같이 뜸

Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving allbuild scripts full access to your system.

 

 

1. Homebrew 위치 확인

우선 손상이 되어서 사라졌는지 나한테는 있긴한건지 Homebrew 위치를 찾아본다.

나는 m1칩을 가진 맥북이라 opt 폴더에 있다.

( 다른 칩을 가진 맥북은 다른 위치에 저장되어 있음. )

$ brew --prefix
>> /opt/homebrew

 

 

 

2.  소유권 이전

해당 디렉에 있는 모든 파일 소유권을 나에게로 바꾼다.

이렇게하면 다시 정상적으로 원래 쓰던 명령어가 들어먹음.

출처는 ( https://directori.tistory.com/124 )

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

$ brew upgrade
// 이게 성공하면 모두 마무리된거임

 

 

3. 그래도 안되면 현재 PATH가 어떻게 지정되어있는지 확인

재설치하는데 뭔가 에러가 둥둥둥 떠서 PATH를 확인해봄.

PATH 중에 /sbin이 있으면 안된다고함.

( 더 자세한 설명 : https://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_install&wr_id=48305 )

( 더 자세한 설명2 :  https://askubuntu.com/questions/800155/service-command-not-found )

$ echo $PATH

 

보니까 homebrew안에 homebrew가 있고 또 homebrew가 있음.

아까 재설치할때 잘못 설치했다가 취소했는데 그새 몇개가 설치되었나봄.

homebrew 삭제후 재설치하기로 함.

 

 

4. Homebrew 삭제

난 귀찮아서 처음 코드만 작성하고 두번째는 local에 들어가서 Homebrew 디렉토리 통째로 삭제함.

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
$ rm -rf Homebrew/

 

 

5.  Homebrew 재설치

https://hancoco.tistory.com/68

 

[220125] NODEJS, 무작정 맥에서 시작하기 (M1칩)

( 맥북을 사용하는 관계로 맥OS 기준으로 작성.) 윈도우와 다르게 맥OS는 터미널만 켜서 설치가 가능하다고 한다! dock에 등록해서 실행하는 법도 있겠지만, 귀찮아서 단축키를 만들어서 쓰고 있다

hancoco.tistory.com

 

 

여기서 다시 이 에러가 뜨면

Running Homebrew as root is extremely dangerous and no longer supported.As Homebrew does not drop privileges on installation you would be giving allbuild scripts full access to your system.

 

위의 과정을 한번 더 반복하면 해결됨.

댓글