Skip to content
困った時に思い出したい

[macOS] MongoDBのインストール

db1 min read

ググって出てきた日本語のページの内容では上手くいかず、公式のドキュメントに沿ってやってみたらできたのですが、現時点の日本語でのメモとして残しておきます。

環境

  • Mac OS X 10.14.6
  • Homebrew 2.1.12

実践

まずはbrewにmongodbを追加します。

brew tap mongodb/brew

それからインストールします。

※公式では4.2となってましたが、途中まで打ってtabで補完したときに4.0までしか出なかったので4.0で進めます。

brew install mongodb-community@4.0

次にPATHを通します。

echo 'export PATH="/usr/local/opt/mongodb-community@4.0/bin:$PATH"' >> ~/.bash_profile

PATHを通したら起動してみます。

brew services start mongodb-community@4.0

起動できたら

mongo

これでMongo Shellにも入れます。

ちなみに停止は

brew services stop mongodb-community@4.0

アンインストールは

brew uninstall mongodb-community@4.0

参考: Install MongoDB Community Edition on macOS | MongoDB Manual

© 2021 by 困った時に思い出したい. All rights reserved.
Theme by LekoArts