1. 개요

맥에 MongoDB를 설치하는 시나리오이다.


2. brew 설치 시도 (실패)

$ brew install mongodb
Updating Homebrew...
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
Error: No available formula or cask 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 taps on GitHub...

자꾸 GitHub 창이 뜬다. 

Error: No formulae found in taps.

거부를 누르면 에러가 나고 끝나버린다.


3. 재시도

$ brew tap mongodb/brew

만약 xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun 에러가 나면 여기를 참고한다.

$ brew install mongodb-community@4.4
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
pomatez
==> Updated Casks
timche-gmail-desktop

==> Installing mongodb-community from mongodb/brew
==> Downloading https://fastdl.mongodb.org/tools/db/mongodb-database-tools-macos-x86_64-100.2.0.zip
Already downloaded: /Users/jins/Library/Caches/Homebrew/downloads/db834c8836688e5200d289c657855530f1b924499d732af2724586cba9d86015--mongodb-database-tools-macos-x86_64-100.2.0.zip
==> Downloading https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.4.1.tgz
Already downloaded: /Users/jins/Library/Caches/Homebrew/downloads/d46781539dca95a7ced7d9b466b13bd4cc0202f17a8bf4bd499a5e1a4a241262--mongodb-macos-x86_64-4.4.1.tgz
==> Installing dependencies for mongodb/brew/mongodb-community: mongodb-database-tools
==> Installing mongodb/brew/mongodb-community dependency: mongodb-database-tools
🍺  /usr/local/Cellar/mongodb-database-tools/100.2.0: 13 files, 172.9MB, built in 4 seconds
==> Installing mongodb/brew/mongodb-community
==> 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.4.1: 11 files, 136.8MB, built in 3 seconds
==> Caveats
==> mongodb-community
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

4. 기동

위에 나온 커맨드 mongod... 를 실행한다.

포트는 27017이다.


5. 접속 테스트

$ mongo
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("41f066b2-05f9-46d9-8f76-bba3ff834b41") }
MongoDB server version: 4.4.1
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    https://docs.mongodb.com/
Questions? Try the MongoDB Developer Community Forums
    https://community.mongodb.com
---
The server generated these startup warnings when booting:
        2020-11-15T17:58:42.117+09:00: ***** SERVER RESTARTED *****
        2020-11-15T17:58:42.823+09:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
        2020-11-15T17:58:42.826+09:00: Soft rlimits too low
        2020-11-15T17:58:42.826+09:00:         currentValue: 4864
        2020-11-15T17:58:42.826+09:00:         recommendedMinimum: 64000
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> use test
switched to db test
> db
test
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
>