LoginSignup
11
2

More than 1 year has passed since last update.

mongoコマンドが使えない command not found: mongo

Last updated at Posted at 2023-03-14

MongoDBの学習中に教材に沿って進めていると環境構築で詰まったので、その際に調べた解決方法をまとめました。

開発環境

macOS Big Sur 11.6
Homebrew 3.6.18
MongoDB 5.0.14

詰まった内容

$ brew install mongodb-community

$ mongo --help #mongoコマンド確認用
zsh: command not found: mongo

学習していた教材ではbrew install mongodb-communityでmongoコマンドが使用できると記載されていましたが、実際はそれだけではmongoコマンドは使用できませんでした。

解決方法

$ brew install mongodb-community-shell

brew install mongodb-communityの後に上記コマンドを実行することでmongoコマンドが使用できるようになりました。

以前はMongoDBのパッケージにはmongoコマンドの実行に必要なMongoシェルも含まれていたようですが、バージョンアップによりMongoDBサーバーとMongoシェルが別々のパッケージに分割されたようです。
そのため、brewコマンドでMongoDBをインストールした場合は、Mongoシェルは別でインストールする必要があります。

参考記事

11
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
2