Skip to content

Instantly share code, notes, and snippets.

@ingebrixen
Created November 7, 2022 08:21
Show Gist options
  • Save ingebrixen/6c9188a649d3a5b79780e9c33f79cada to your computer and use it in GitHub Desktop.
Save ingebrixen/6c9188a649d3a5b79780e9c33f79cada to your computer and use it in GitHub Desktop.
MacOS: ddev dbeaver - open DBeaver for your current ddev project
#!/bin/bash
#ddev-generated
# Support for dbeaver
# This command is available if macOS and dbeaver is installed in the normal place
## Description: Run dbeaver with current project database
## Usage: dbeaver
## Example: "ddev dbeaver"
## OSTypes: darwin
## HostBinaryExists: /Applications/DBeaver.app
dbtype=${DDEV_DBIMAGE%:*}
driver=mysql
if [[ $dbtype == "postgres" ]]; then
driver=$dbtype
fi
query="-con name=ddev-${DDEV_PROJECT}|driver=$driver|database=db|user=root|password=root|host=127.0.0.1|port=${DDEV_HOST_DB_PORT}"
set -x
open -a /Applications/DBeaver.app/Contents/MacOS/dbeaver --args $query
@ingebrixen
Copy link
Author

Place the file in ~/.ddev/commands/host/. Use ddev dbeaver in your current ddev project folder to start DBeaver and connect to the Docker database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment