{"id":28744183,"url":"https://github.com/ipinfo/mmdbctl","last_synced_at":"2025-10-31T10:53:51.950Z","repository":{"id":42992328,"uuid":"457343227","full_name":"ipinfo/mmdbctl","owner":"ipinfo","description":"mmdbctl is an MMDB file management CLI supporting various operations on MMDB database files.","archived":false,"fork":false,"pushed_at":"2025-01-29T20:15:26.000Z","size":140,"stargazers_count":135,"open_issues_count":5,"forks_count":17,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-13T11:55:45.206Z","etag":null,"topics":["cli","mmdb","mmdbctl"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ipinfo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-09T12:10:14.000Z","updated_at":"2025-06-12T12:41:49.000Z","dependencies_parsed_at":"2023-12-22T12:53:08.742Z","dependency_job_id":"a9e0df2b-0554-4b03-be25-35f18a6c3013","html_url":"https://github.com/ipinfo/mmdbctl","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ipinfo/mmdbctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fmmdbctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fmmdbctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fmmdbctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fmmdbctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ipinfo","download_url":"https://codeload.github.com/ipinfo/mmdbctl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ipinfo%2Fmmdbctl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260148401,"owners_count":22965915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","mmdb","mmdbctl"],"created_at":"2025-06-16T11:10:59.418Z","updated_at":"2025-10-31T10:53:51.937Z","avatar_url":"https://github.com/ipinfo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [\u003cimg src=\"https://ipinfo.io/static/ipinfo-small.svg\" alt=\"IPinfo\" width=\"24\"/\u003e](https://ipinfo.io/) IPinfo `mmdbctl`\n\n`mmdbctl` is an MMDB file management CLI by [IPinfo.io](https://ipinfo.io) that provides you\nthe following features:\n\n- Read data for IPs in an MMDB file.\n- Import data in non-MMDB format into MMDB.\n- Export data from MMDB format into non-MMDB format.\n- See the difference between two MMDB files.\n- Print the metadata of an MMDB file.\n- Check that an MMDB file is not corrupted or invalid.\n\n## Installation\n\nThe `mmdbctl` CLI is available for download via multiple mechanisms.\n\n### macOS\n\nInstall the latest `amd64` version:\n\n```bash\ncurl -Ls https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/macos.sh | sh\n```\n\n### Debian / Ubuntu (amd64)\n\n```bash\ncurl -Ls https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/deb.sh | sh\n```\n\nOR\n\n```bash\ncurl -LO https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/mmdbctl_1.4.8.deb\nsudo dpkg -i mmdbctl_1.4.8.deb\n```\n\n### Windows Powershell\n\n_Note_: run powershell as administrator before executing this command.\n\n```bash\niwr -useb https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/windows.ps1 | iex\n```\n\n### Using `go install`\n\nMake sure that `$GOPATH/bin` is in your `$PATH`, because that's where this gets\ninstalled:\n\n```bash\ngo install github.com/ipinfo/mmdbctl@latest\n```\n\n### Using `curl`/`wget`\n\nThe pre-built binaries for all platforms are available on GitHub via artifacts\nin releases. You need to simply download, unpack and move them to your shell's\nbinary search path.\n\nThe following OS \u0026 arch combinations are supported (if you use one not listed\non here, please open an issue):\n\n```\ndarwin_amd64\ndarwin_arm64\ndragonfly_amd64\nfreebsd_386\nfreebsd_amd64\nfreebsd_arm\nfreebsd_arm64\nlinux_386\nlinux_amd64\nlinux_arm\nlinux_arm64\nnetbsd_386\nnetbsd_amd64\nnetbsd_arm\nnetbsd_arm64\nopenbsd_386\nopenbsd_amd64\nopenbsd_arm\nopenbsd_arm64\nsolaris_amd64\nwindows_386\nwindows_amd64\nwindows_arm\n```\n\nAfter choosing a platform `PLAT` from above, run:\n\n```bash\n# for Windows, use \".zip\" instead of \".tar.gz\"\ncurl -LO https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/mmdbctl_1.4.8_${PLAT}.tar.gz\n# OR\nwget https://github.com/ipinfo/mmdbctl/releases/download/mmdbctl-1.4.8/mmdbctl_1.4.8_${PLAT}.tar.gz\ntar -xvf mmdbctl_1.4.8_${PLAT}.tar.gz\nmv mmdbctl_1.4.8_${PLAT} /usr/local/bin/mmdbctl\n```\n\n### Using `git`\n\nInstalling from source requires at least the Golang version specified in\n`go.mod`. You can install the Golang toolchain from\n[the official site](https://golang.org/doc/install).\n\nOnce the correct Golang version is installed, simply clone the repository and\ninstall the binary:\n\n```bash\ngit clone https://github.com/ipinfo/mmdbctl\ncd mmdbctl\ngo install .\n$GOPATH/bin/mmdbctl\n```\n\nYou can add `$GOPATH/bin` to your `$PATH` to access `mmdbctl` directly from\nanywhere.\n\nAlternatively, you can do the following to output the binary somewhere\nspecific:\n\n```bash\ngit clone https://github.com/ipinfo/mmdbctl\ncd mmdbctl\ngo build -o \u003cpath\u003e .\n```\n\nReplace `\u003cpath\u003e` with the required location.\n\n## Quick Start\n\nThis will help you quickly get started with the `mmdbctl` CLI.\n\n### Default Help Message\n\nBy default, invoking the CLI shows a help message:\n\n![mmdbctl](images/help.png)\n\n### Reading\n\nYou can read from MMDB files in various different ways - as individual IPs,\nCIDRs or IP ranges, coming from the command line as arguments, or from files,\nor from stdin.\n\nPretty JSON format:\n\n```bash\n$ mmdbctl read -f json-pretty 8.8.8.8 location.mmdb\n{\n  \"city\": \"Mountain View\",\n  \"country\": \"US\",\n  \"geoname_id\": \"5375480\",\n  \"latitude\": \"37.4056\",\n  \"longitude\": \"-122.0775\",\n  \"postalcode\": \"94043\",\n  \"region\": \"California\",\n  \"timezone\": \"America/Los_Angeles\"\n}\n```\n\nCSV format:\n\n```bash\n$ mmdbctl read -f csv 8.8.8.8 location.mmdb\nip,city,country,geoname_id,latitude,longitude,postalcode,region,timezone\n8.8.8.8,Mountain View,US,5375480,37.4056,-122.0775,94043,California,America/Los_Angeles\n```\n\nTSV format:\n\n```bash\n$ mmdbctl read -f tsv 8.8.8.8 location.mmdb\nip\tcity\tcountry\tgeoname_id\tlatitude\tlongitude\tpostalcode\tregion\ttimezone\n8.8.8.8\tMountain View\tUS\t5375480\t37.4056\t-122.0775\t94043\tCalifornia\tAmerica/Los_Angeles\n```\n\nVia a file:\n\n```bash\n$ cat ips.txt\n8.8.8.8\n8.8.8.0/31\n8.8.8.0-8.8.8.1\n8.8.8.0,8.8.8.1\n\n$ mmdbctl read ips.txt location.mmdb | sort -u\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n```\n\nVia stdin:\n\n```bash\n$ echo 8.8.8.8 | mmdbctl read location.mmdb\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n```\n\nMultiple inputs are also possible - these all return the same thing:\n\n```bash\n$ echo -e '8.8.8.8\\n1.2.3.4' | mmdbctl read location.mmdb\n$ mmdbctl read 8.8.8.8 1.2.3.4 location.mmdb\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n{\"city\":\"Brisbane\",\"country\":\"AU\",\"geoname_id\":\"2174003\",\"latitude\":\"-27.48203\",\"longitude\":\"153.01358\",\"postalcode\":\"4101\",\"region\":\"Queensland\",\"timezone\":\"Australia/Brisbane\"}\n```\n\nCan check CIDRs and ranges - these will all return the same thing:\n\n```bash\n$ mmdbctl read 8.8.8.0/31 location.mmdb\n$ mmdbctl read 8.8.8.0-8.8.8.1 location.mmdb\n$ mmdbctl read 8.8.8.0,8.8.8.1 location.mmdb\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n{\"city\":\"Mountain View\",\"country\":\"US\",\"geoname_id\":\"5375480\",\"latitude\":\"37.4056\",\"longitude\":\"-122.0775\",\"postalcode\":\"94043\",\"region\":\"California\",\"timezone\":\"America/Los_Angeles\"}\n```\n\n### Importing\n\nImporting allows taking in files as CSV/TSV/JSON, and outputting an MMDB file.\n\nImporting is one of the most powerful/flexible features in `mmdbctl`. However,\nwe only allow strings throughout the data at the current time.\n\nSee `mmdbctl import --help` for full details on usage.\n\nHere are some basic examples:\n\n```bash\n# basic CSV importing into MMDB.\n$ mmdbctl import --in data.csv --out data.mmdb\n\n# generate MMDB from a TSV file containing IPv4 data.\n$ cat data.tsv | mmdbctl import --ip 4 --tsv --out data.mmdb\n\n# don't include the implicit `network` field in the output MMDB:\n$ mmdbctl import --no-network --in data.csv --out data.mmdb\n\n# generate an MMDB without any fields, just IP ranges that meet a criteria.\n$ mmdbctl import                                                              \\\n    --size 24 --no-fields --ip 4                                              \\\n    --in anycast.csv --out anycast.mmdb\n```\n\n### Exporting\n\nExporting allows taking in an MMDB file and outputting CSV/TSV/JSON.\n\nSee `mmdbctl export --help` for full details on usage.\n\n```bash\n# basic export.\n$ mmdbctl export data.mmdb data.csv\n\n# basic export without a header.\n$ mmdbctl export --no-header data.mmdb data.csv\n\n# just see the number of entries it'd output.\n$ mmdbctl export --no-header --format csv data.mmdb | wc -l\n```\n\n### Metadata\n\nYou can retrieve data in the `metadata` section of the MMDB file using the\n`metadata` subcommand.\n\nPretty format:\n\n```bash\n$ mmdbctl metadata location.mmdb\n- Binary Format 2.0\n- Database Type ipinfo location.mmdb\n- IP Version    4\n- Record Size   32\n- Node Count    123456789\n- Description\n    en ipinfo location.mmdb\n- Languages     en\n- Build Epoch   123456789\n```\n\nJSON format:\n\n```bash\n$ mmdbctl metadata -f json location.mmdb\n{\n    \"binary_format\": \"2.0\",\n    \"db_type\": \"ipinfo location.mmdb\",\n    \"ip\": 4,\n    \"record_size\": 32,\n    \"node_count\": 123456789,\n    \"description\": {\n        \"en\": \"ipinfo location.mmdb\"\n    },\n    \"languages\": [\n        \"en\"\n    ],\n    \"build_epoch\": 123456789\n}\n```\n\n### Verification\n\nYou can verify if a MMDB file is correctly structured with the `verify`\nsubcommand:\n\n```bash\n$ mmdbctl verify location.mmdb\nvalid\n```\n\nLet's force it to be invalid and check again:\n\n```bash\n$ cp location.mmdb location-tmp.mmdb\n$ cat location.mmdb \u003e\u003e location-tmp.mmdb\n$ mmdbctl verify location-tmp.mmdb\ninvalid: received decoding error (the MaxMind DB file's data section contains bad data (uint16 size of 11)) at offset of 13825601\n```\n\n## Auto-Completion\n\nAuto-completion is supported for at least the following shells:\n\n```\nbash\nzsh\nfish\n```\n\nNOTE: it may work for other shells as well because the implementation is in\nGolang and is not necessarily shell-specific.\n\n### Installation\n\nInstalling auto-completions is as simple as running one command (works for\n`bash`, `zsh` and `fish` shells):\n\n```bash\nmmdbctl completion install\n```\n\nIf you want to customize the installation process (e.g. in case the\nauto-installation doesn't work as expected), you can request the actual\ncompletion script for each shell:\n\n```bash\n# get bash completion script\nmmdbctl completion bash\n\n# get zsh completion script\nmmdbctl completion zsh\n\n# get fish completion script\nmmdbctl completion fish\n```\n\n### Shell not listed?\n\nIf your shell is not listed here, you can open an issue.\n\nNote that as long as the `COMP_LINE` environment variable is provided to the\nbinary itself, it will output completion results. So if your shell provides a\nway to pass `COMP_LINE` on auto-completion attempts to a binary, then have your\nshell do that with the `mmdbctl` binary itself (or any of our binaries).\n\n## Color Output\n\n### Disabling Color Output\n\nAll our CLIs respect either the `--nocolor` flag or the\n[`NO_COLOR`](https://no-color.org/) environment variable to disable color\noutput.\n\n### Color on Windows\n\nTo enable color support for the Windows command prompt, run the following to\nenable [`Console Virtual Terminal Sequences`](https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences).\n\n```cmd\nREG ADD HKCU\\CONSOLE /f /v VirtualTerminalLevel /t REG_DWORD /d 1\n```\n\nYou can disable this by running the following:\n\n```cmd\nREG DELETE HKCU\\CONSOLE /f /v VirtualTerminalLevel\n```\n\n## Other IPinfo Tools\n\nThere are official IPinfo client libraries available for many languages including PHP, Python, Go, Java, Ruby, and many popular frameworks such as Django, Rails and Laravel. There are also many third party libraries and integrations available for our API.\n\nSee [https://ipinfo.io/developers/libraries](https://ipinfo.io/developers/libraries) for more details.\n\n## About IPinfo\n\nFounded in 2013, IPinfo prides itself on being the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier, VPN detection, hosted domains, and IP type data sets. Our API handles over 40 billion requests a month for businesses and developers.\n\n[![image](https://avatars3.githubusercontent.com/u/15721521?s=128\u0026u=7bb7dde5c4991335fb234e68a30971944abc6bf3\u0026v=4)](https://ipinfo.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Fmmdbctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fipinfo%2Fmmdbctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fipinfo%2Fmmdbctl/lists"}