xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

MongoDB & macOS & brew All In One

MongoDB & macOS & brew All In One

MongoDB 4.2 Manual

https://docs.mongodb.com/manual/

install MongoDB

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/#install-mongodb-community-edition

1. CLI install

$ brew tap mongodb/brew

# MongoDB Community Edition
$ brew install mongodb-community@4.2

# /usr/local/etc/mongod.conf
# /usr/local/var/log/mongodb
# /usr/local/var/mongodb

$ brew services list

# server
$ brew services start mongodb-community@4.2

$ brew services stop mongodb-community@4.2

$ mongod --config /usr/local/etc/mongod.conf --fork


$ ps aux | grep -v grep | grep mongod

# client
$ mongo

In addition to the binaries, the install creates:

the configuration file (/usr/local/etc/mongod.conf)
the log directory path (/usr/local/var/log/mongodb)
the data directory path (/usr/local/var/mongodb)

https://github.com/mongodb/homebrew-brew

https://docs.mongodb.com/manual/reference/configuration-options/

$ brew untap mongodb/brew && brew tap mongodb/brew

$ brew install mongodb-community@4.2

2. zip 手动安装 4.2.x

https://www.mongodb.com/try/download/community

https://www.mongodb.com/dr/fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz/download

跳过, 直接下载

https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz

4.2.8

# download .tgz,  https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.8.tgz
$ cd Downloads 

# unzip
$ tar xzf mongodb-macos-x86_64-4.2.8.tgz

# move to  /usr/local/
$ sudo mv mongodb-macos-x86_64-4.2.8 /usr/local/mongodb 

$ sudo mkdir /data/db
# mkdir: /data: No such file or directory
$ sudo mkdir -p /data/db
mkdir: /data/db: Read-only file system

# macOS 14.x -
$ sudo mkdir -p /data/db

# macOS 15.x +
$ sudo mkdir -p /System/Volumes/Data/data/db

https://stackoverflow.com/questions/58034955/read-only-file-system-when-attempting-mkdir-data-db-on-mac

https://stackoverflow.com/questions/58034955/read-only-file-system-when-attempting-mkdir-data-db-on-mac

macOS 15.x upgrade bug

.zshrc

# mongodb ENV 2020.04.23
# export PATH=/usr/local/mongodb/bin:$PATH
export PATH="$PATH:/usr/local/mongodb/bin:$PATH"
# export PATH=":$PATH:/usr/local/mongodb/bin"

MongoDB GUI tools

  1. MongoDB Compass

  2. Robo 3T

Serverless API

Daas, Database as a Service

  1. MLab

macOS 13.x

mongodb-community@4.2

# brew services
$ brew services list
Name                  Status  User       File
httpd                 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist
php                   none

# brew services stop

$ brew services stop mongodb-community@4.2
Stopping `mongodb-community@4.2`... (might take a while)
==> Successfully stopped `mongodb-community@4.2` (label: homebrew.mxcl.mongodb-community@

$ brew services list
Name                  Status  User       File
httpd                 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 none
php                   none


# brew services start
$ brew services start mongodb-community@4.2

# brew services restart
$ brew services restart mongodb-community@4.2


$ mongo

https://www.cnblogs.com/xgqfrms/p/9770091.html#5132005

refs

https://stackoverflow.com/questions/30678422/installing-mongodb

https://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/

https://coderwall.com/p/fb5dgg/the-best-mongodb-gui-for-mac-os-x

https://treehouse.github.io/installation-guides/mac/mongo-mac.html



©xgqfrms 2012-2025

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @   xgqfrms  阅读(336)  评论(28编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2015-10-11 fullpage.js All In One
点击右上角即可分享
微信分享提示