はじめに
MongoDBが必要だからインストールしようと思って
$ brew install mongodb
Error: No available formula with the name "mongodb"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
と怒られたのでインストール方法を残す
方法
ちなみにbrew search mongodb
すると
$ brew search mongodb
==> Casks
gcollazo-mongodb mongodb-compass-community mongodb-compass-readonly nosqlbooster-for-mongodb
mongodb-compass mongodb-compass-isolated-edition mongodbpreferencepane homebrew/cask-versions/mongodb-compass-beta
なくなってる。。
どうやら、MongoDBがOSSじゃなくなったらしいので以下を実行
$ brew tap mongodb/brew
==> Tapping mongodb/brew
Cloning into '/usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 13 (delta 4), reused 5 (delta 1), pack-reused 0
Unpacking objects: 100% (13/13), done.
Tapped 6 formulae (46 files, 60.1KB).
$ brew install mongodb-community
==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.1.tgz
######################################################################## 100.0%
==> Caveats
To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
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-community/4.2.1: 21 files, 273.5MB, built in 26 seconds
$ brew services start mongodb-community
==> Successfully started `mongodb-community` (label: homebrew.mxcl.mongodb-community)
これで使えるようになる
ちなみにbrew tap
なるものを初めて使ったが、
brew tapとは公式以外のリポジトリをフォーミュラとしてHomebrewに追加するもので、brewのもとでinstall,uninstall,updateなどが行えます。もちろん自分が公開しているものも簡単に追加できます。
(引用) brew tapとは
らしいです。