$ brew install postgresql
$ vim ~/.zshrc
VIM commands
GG(go to end of file)o(insertmode on new line)
paste the function below
# postgres service
postgres() {
brew services $1 postgresql
}esc(exitinsertmode):x(write and quit, same as:wq)
$ source ~/.zshrc
if you just installed then create a database for your user account
(if you dont do this step you will need to log in as the default postgres user every time)
$ createdb <your user account name>
you dont have to use this db it is just a default for connecting to the shell
start the psql server
$ postgres start
enter psql shell
$ psql
exit psql shell
> \q
stop the psql server
$ postgres stop
$ brew install mongodb-community@4.0
$ vim ~/.zshrc
VIM commands
GG(go to end of file)o(insertmode on new line)
paste the function below
# mongodb service
mongodb() {
brew services $1 mongodb-community@4.0
}esc(exitinsertmode):x(write and quit, same as:wq)
$ source ~/.zshrc
start the mongo server
$ mongodb start
enter mongo shell
$ mongo
exit mongo shell
> exit
stop the mongo server
$ mongodb stop