mc — MinIO Client S3 CLI
S3-compatible object storage is the default choice for buckets, backups, and static assets. When AWS CLI feels excessive and the web console is too clunky, MinIO Client (mc) fills the gap. This CLI tool works with any S3-compatible storage: MinIO, Yandex Cloud, AWS S3, Backblaze B2. Zero dependencies, works out of the box, configured in under a minute.
Installation
Download the binary and make it executable:
Verify the version:
For macOS, use Homebrew:
mc is a single static binary with no dependencies. Works perfectly in containers and minimal base images.
Adding an Alias
An alias is a named connection to an S3 endpoint. Without it, every command requires the full URL.
After this, myminio replaces the URL in all commands. List existing aliases:
In production, avoid storing keys in command history. Use environment variables: mc alias set prod ${S3_ACCESS_KEY} ${S3_SECRET_KEY} --api API-S3v4 and substitute via env.
For S3-compatible services with self-signed certificates:
Browsing and Navigation
List buckets:
Recursive listing with contents:
Object metadata:
mc ls without --recursive shows only top-level buckets. Use prefixes to navigate folders inside a bucket.
Working with Buckets
Create a bucket:
If the bucket already exists, mc reports an error. The --ignore-existing flag suppresses it:
Remove an empty bucket:
For non-empty buckets, use force:
Working with Objects
Print object contents to stdout without downloading:
Remove an object:
Recursive removal by pattern:
mc rm without --force asks for confirmation. Always use --force in scripts.
Find objects by criteria:
Combine with deletion:
Uploading and Downloading
Copy a local file to a bucket:
Multiple upload:
Download an object locally:
Copy between buckets (or across aliases):
Flags for flow control:
| Flag | Purpose |
|---|---|
--recursive | Process directories recursively |
--force | Overwrite without prompting |
--preserve | Keep file attributes (mtime, ACL) |
--if-not-exists | Skip already existing objects |
--disable-multipart | Upload in a single PUT request |
Mirroring
One-way directory synchronization:
Flags for production use:
| Flag | Purpose |
|---|---|
--overwrite | Replace changed files |
--delete | Remove files in destination missing from source |
--watch | Monitor for changes in real time |
--md5 | Verify MD5 after upload |
--delete is dangerous: it removes files in the destination that don’t exist in the source. Test with --dry-run or use --preserve for backup scenarios.
Dry-run — show what would happen without making changes:
Access Policies
Set public access on a bucket:
Common policies:
View current policy:
Generate a presigned URL (works for private buckets too):
Output contains the signed URL and expiration time.
Useful Flags
Global flags working with any command:
| Flag | Purpose |
|---|---|
--debug | Verbose HTTP request/response output |
--json | JSON output (easy to parse in scripts) |
--no-color | Disable colored output |
--insecure | Skip TLS certificate verification |
--config-dir | Config path (default ~/.mc) |
--limit | Rate limit (e.g., --limit 10MiB/s) |
JSON output for automation:
Progress for large file copies:
Shell Completion
Bash/zsh autocompletion saves time:
After enabling, type mc and press Tab twice to see available commands and aliases.
mc covers 90% of S3 tasks. For complex scenarios (versioning, lifecycle policies, encryption) — use the API or a Terraform provider. But basic bucket and object operations are faster with this tool than with any SDK.