How do I download MongoDB Server on M1 Mac? - mongodb

I've tried probably 10 different sites looking how to download MongoDB on M1 Mac. And I would like to put this here for anyone who wants to make a step-by-step guide to get MongoDB working on M1 Macs. Feel free to edit this and provide your steps.
For example if I run the following command (brew install mongodb-community#4.4), the following error occurs:
Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!
To rerun under ARM use:
arch -arm64 brew install ...
To install under x86_64, install Homebrew into /usr/local.
And then I try rerunning in ARM. And it installs successfully. Then I run mongod and get zsh: command not found: mongod. How is this possible?? It's weird because mongo command works just as expected. So mongodb-community is downloaded but I can't access the mongod command.
Does anyone know why? I've tried changing the path but mongod isn't anywhere local...
-- Starting from Rosetta Terminal:

Related

Can't install powershell in Parallels Kali Linux Virtual Machine

I've been trying to install Powershell for a few hours now. I run this under root:
apt update && apt -y install powershell
This is what I end up getting after it runs through and seemingly downloads
Package powershell is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'powershell' has no installation candidate
When I try to run this same command outside of root using sudo, I get the following:
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
I have updated everything and tried a few different ways. I even downloaded a completely new Virtual Machine in Parallels to see if restarting would help out. I still run into the same problems. This is a Kali Linux VM on Parallels MacOS M1. Not sure if that matters or not. I think Parallels itself may possibly be using an apt process in the background, but when I do:
sudo killall apt apt-get
I end up getting
apt: no process found
apt-get: no process found
I've been trying everything. I'm on a new Mac so I don't have too many VM options. If someone could figure this out in Parallels, it would be a great help.
I've tried a lot. In the description above.
To install PowerShell in Kali Linux open the terminal and type:
sudo apt update
sudo apt install -y snapd # install daemon and tooling that enable snap packages
sudo systemctl enable --now snapd apparmor
Log out and back in again, and run the following command to install the powershell snap package.
sudo snap install powershell --classic

mongodb-community not working on Apple M1

I've installed mongodb-community version 5.0 using brew, following this post's answer for M1 Apple Silicon Macs: How to install Mongodb on Apple M1 chip
Everything works fine, until the 6th step.
After running "mongo" in my terminal, I get the following errors.
I searched over stackoverflow and suspected that perhaps the mongodb service is not running, but the command "brew services list" gives the
following output.
Running "mongod" gives the following error.
Yet, checking "mongo --version" gives a clear indication of installation.
I have also uninstalled mongodb various times, started afresh with the whole procedure.
I'm so frustrated at this point. It would be really helpful if someone could let me know what's wrong in this process/how I could fix it.
PS: This is one of my first posts and I'm sorry if it is not structured well or does not follow a community guideline. I can try to edit the post if any rule is violated.
Thank you.
This solution worked for me
Read-only file system when attempting mkdir /data/db on Mac
rom the official docs https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
Install homebrew and run the following commands
sudo chown -R $(whoami) $(brew --prefix)/*
then
brew tap mongodb/brew
then
brew install mongodb-community#4.2
and
brew services start mongodb-community
or
mongod --config /usr/local/etc/mongod.conf
then
ps aux | grep -v grep | grep mongod
and
mongo
to verify you can run show dbs in the mongo shell
Please follow this step for reinstalling mongodb, it works for me:
1st: run this command (Prerequisites)
xcode-select --install
\\note: Homebrew requires the Xcode commandline tools
2nd: install Homebrew for M1 chip (Prerequisites)
3rd: run this command to get Homebrew formula that work with mongodb
brew tap mongodb/brew
4th: run this command to get mongodb version 5
brew install mongodb-community#5.0
5th: run this command to run mongodb in the background
brew services start mongodb-community#5.0
// I notice that if I don't run this command I cannot connect to the server and receive the same error message like you
6th: just run mongo and enjoy. I hope it works.

zsh: command not found: vim

I have an issue in flutter installation on MacBook Air M1 chip. It drives me crazy. I get the error :
zsh: command not found: vim
screenshot
I enabled rosetta terminal and re-run it again, but same issue.
I tried almost all installation videos online but nothing helped.
You don't have vim. To install it, run the command below :
sudo apt-get install vim
You can also use nano. Also, it's vim ~/.zshrc (where ~/ refers to the home directory of the current user) and you also misspelled zshrc.
I suggest you follow the official docs for the correct installation steps.
I have also created a detailed blogpost about the installation steps and the possible issues that one might encounter. It is written extensively for MacBook Air with M1 chip running BigSur (which I work on).

Mongo command not found on Mac using zsh?

I installed Mongo Db via the official site. I also created the below folder
~/data/db
I added the mongo files in the location as follows :
/usr/local/mongodb
Im using zsh so setting the environment variables as suggested in the bash_profile doesnt work for me.
My .zshrc file looks as follows
export PATH=$HOME/bin:/usr/local/bin:$PATH
export MONGO_PATH=/usr/local/mongodb
export PATH=MONGO_PATH/bin:$PATH
I also ran the source command as follows :
source ~/.zshrc
However even after trying variations of various answers, I still get :
zsh: command not found: mongo
What am I missing here?
I have the same problem when I try to install Mongo with official doc
This instruction help me to run MongoDB on MacOS Mojave 10.14.6
Try mongod --version
If there is no Mongodb installed try enter brew install mongodb
After this check installation again with mongod --version
Then use brew services start mongodb to run MongoDB on startup
Try brew install mongodb-community-shell.
My case:
I did try brew services start mongodb to solve it, but face this issue:
Error: No available formula with the name "mongodb". Did you mean mongosh or monetdb?
Here is a recommendation on how to solve it where brew install mongodb-community-shell mentioed as part install of the latest Mongo shell: https://developpaper.com/fix-mac-brew-installation-mongodb-error-no-available-formula-with-the-name-mongodb/
this one worked for me.in new macbook or air we cant find .zhrc or bash
in new mac its .zprofile. so change the path in .zprofile
export PATH=/opt/homebrew/bin:$PATH
brew install mongodb-community-shell
you can try it it work for me because when downloading mongodb it lacks the shell so when typing mongo in terminal it won't work

Mongo Setting Path

I am currently running macOS Sierra (latest version) and I have zshell installed. I have tried to follow the steps to install MongoDB Community Edition Manually by using the following commands after downloading the binaries from the MongoDB Download Center.
tar -zxvf mongodb-osx-ssl-x86_64-3.6.2.tgz
mkdir -p mongodb
cp -R -n mongodb-osx-ssl-x86_64-3.6.2/ mongodb
export PATH=mongodb-install-directory/bin:$PATH
On step 4, my mongodb install directory path is in /Users/(my username)/mongodb. Therefore, I have run the following command:
export PATH=/Users/(my username)/mongodb/bin:$PATH
From the (my username) directory, I tried to run mongod and got the message zsh: command not found: mongod. However, when I go into /Users/(my username)/mongodb/bin and run ./mongod, everything works except for my data path not being set.
From here, I have tried to set the db path by running the following command:
./mongod --dbpath /Users/(my username)/mongodb/data/db
Then I ran ./mongod and the data path was not found. What am I doing wrong? I even tried to install MongoDB Community Edition with Homebrew and the same errors popped up.
I am not sure if this would make a difference, but I have installed vagrant in the past and I was able to use MongoDB.
I suggest re-install MongoDB once again, use brew
brew update
brew install mongodb