[Mac] brew cleanup 時出現 mongodb: most recent version not installed 訊息?
在使用 OmniDiskSweeper 檢視硬碟空間大小時,
發現 Homebrew 在 /usr/local/Cellar 目錄下,占據了不少空間…
根據網路上查到的建議,使用 brew cleanup 來清除舊版的檔案,
不過在處理到 mongodb 時,卻出現奇怪的錯誤訊息,
說 mongodb 的最新版 4.0.3_1 沒有安裝:
testuser@localhost ~ $ brew cleanup Warning: Skipping mongodb: most recent version 4.0.3_1 not installed
但如果執行 brew update && brew upgrade,
又不會更新到 mongodb…
又上網上查了一下,似乎是有一點 bug,
解法是先移掉 mongodb:
testuser@localhost ~ $ brew uninstall mongodb Uninstalling /usr/local/Cellar/mongodb/4.0.4_1... (18 files, 259.8MB) mongodb 3.6.4, 3.6.3, 3.6.2, 3.6.5, 3.4.10, 4.0.3, 3.6.0, 3.4.4 and 3.6.1 are still installed. Remove all versions with `brew uninstall --force mongodb`.
單純的 brew uninstall 不會清掉舊版的資訊,
因此要用 brew uninstall –force:
testuser@localhost ~ $ brew uninstall --force mongodb Uninstalling mongodb... (169 files, 2.5GB)
這樣子就能清掉了,釋放出 2.5 GB 的空間~
接著,再重新安裝 mongodb 就好了:
testuser@localhost ~ $ brew install mongodb ==> Downloading https://homebrew.bintray.com/bottles/mongodb-4.0.3_1.mojave.bottle.tar.gz ==> Downloading from https://akamai.bintray.com/ab/ab08fc6748bc37d0e2ec209126db3236bd80a2ae4edee2f6fc34d96481fe34c7?__gda__=exp=1558509720~hmac=f586d5d75625c9 ######################################################################## 100.0% ==> Pouring mongodb-4.0.3_1.mojave.bottle.tar.gz ==> Caveats To have launchd start mongodb now and restart at login: brew services start mongodb Or, if you don't want/need a background service you can just run: mongod --config /usr/local/etc/mongod.conf ==> Summary 🍺 /usr/local/Cellar/mongodb/4.0.3_1: 18 files, 258.1MB
參考資料:
macos – How can I remove outdated installed versions of Homebrew packages? – Super User
brew cleanup shows incorrect version for MongoDB · Issue #5637 · Homebrew/brew
(本頁面已被瀏覽過 862 次)