[Homebrew] mac cpu에 따라 homebrew path가 다르다

정유진·2022년 7월 8일
0

etc

목록 보기
1/2
post-thumbnail

출처: https://mac.install.guide/ruby/3.html

homebrew path

$ brew
  1. arm64 (m1 이상)
/opt/homebrew
  1. intel86
/usr/local
  • swift로 shell script를 run하는 코드를 작성하던 중
  • constant로 넣어두었던 homebrew 라이브러리의 경로가 mac 기종에 따라 다르다는 것을 깨달았다.
  • machine 종류에 따라 분기 처리가 필요했다.
public enum Executable: String {
    case xchtmlreport_arm64 = "/opt/homebrew/bin/xchtmlreport"
    case xchtmlreport_intel = "/usr/local/bin/xchtmlreport"
    
    var path: String {
        return self.rawValue
    }
}
profile
느려도 한 걸음 씩 끝까지

0개의 댓글