錯誤訊息

最近把 Mac OS 從 Monterey 升級到 Ventura 後, Homebrew 安裝的 Postgresql 就跑不起來:

1
2
3
4
5
6
$ brew services info postgresql
Warning: Use postgresql@14 instead of deprecated postgresql
postgresql@14 (homebrew.mxcl.postgresql@14)
Running: ✘
Loaded: ✔
Schedulable: ✘

重啟或重新安裝都沒有用,也沒有明確的錯誤訊息。到 Homebrew 的 log 資料夾下查詢:

1
$ tail /opt/homebrew/var/log/postgres.log

看到錯誤訊息:

1
2
Referenced from: <B17C4116-8D6C-32B3-8403-3EBE2BBCA14E> /opt/homebrew/Cellar/postgresql@14/14.2_1/bin/postgres
Reason: tried: '/opt/homebrew/opt/icu4c/lib/libicui18n.70.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/icu4c/lib/libicui18n.70.dylib' (no such file), '/opt/homebrew/opt/icu4c/lib/libicui18n.70.dylib' (no such file), '/usr/local/lib/libicui18n.70.dylib' (no such file), '/usr/lib/libicui18n.70.dylib' (no such file, not in dyld cache), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicui18n.70.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/icu4c/72.1/lib/libicui18n.70.dylib' (no such file), '/opt/homebrew/Cellar/icu4c/72.1/lib/libicui18n.70.dylib' (no such file), '/usr/local/lib/libicui18n.70.dylib' (no such file), '/usr/lib/libicui18n.70.dylib' (no such file, not in dyld cache)

主要錯誤訊息

1
libicui18n.70.dylib' (no such file)

解決方法

重新安裝 icu4c :

1
$ brew reinstall icu4c

重啟 postgresql :

1
$ brew services restart postgresql

成功啟動:

1
2
3
4
5
6
7
8
$ brew services info postgresql
Warning: Use postgresql@14 instead of deprecated postgresql
postgresql@14 (homebrew.mxcl.postgresql@14)
Running: ✔
Loaded: ✔
Schedulable: ✘
User: emn178
PID: 17984