Quick Reference
Command Availability
| Command | Description | OSS | Pro |
|---|---|---|---|
init | Initialize a new Mage project at the specified path | ✅ | ✅ |
start | Start the Mage server and web UI | ✅ | ✅ |
run | Execute a pipeline or a specific block within a pipeline | ✅ | ✅ |
clean_cached_variables | Clean up old pipeline run outputs based on retention period | ✅ | ✅ |
clean_old_logs | Clean up old pipeline run logs based on retention period | ✅ | ✅ |
clean_unused_blocks | Clean up unused blocks from the project (interactive) | ❌ | ✅ |
create_secret | Create or update a secret for the given Mage project | ❌ | ✅ |
run_post_start_hooks | Execute post-start hooks with graceful error handling | ❌ | ✅ |
restart_jobs | Restart failed or cancelled pipeline runs with optional filters | ❌ | ✅ |
update_workspace | Update a workspace configuration synchronously | ❌ | ✅ |
update_all_workspaces | Update all workspaces in the cluster synchronously | ❌ | ✅ |
re_add_workspace_routes | Re-add workspace routes to the ingress (Kubernetes) | ❌ | ✅ |
recover_pipelines_from_file_versions | Recover pipelines from file versions in .file_versions folder | ❌ | ✅ |
Getting Help
To see all available commands:Command Categories
- Project Management - Initialize and start Mage projects
- Pipeline Execution - Run pipelines and blocks
- Maintenance Commands - Clean up variables and logs
- Mage Pro Only Commands - Workspace management and advanced features
Available Commands
Project Management
init - Initialize Mage Project
Available in: ✅ OSS, ✅ Pro
Initialize a new Mage project at the specified path.
Usage:
project_path(required): Path of the Mage project to be created--project-type(optional): Type of project to create. Options:main,sub, orstandalone(default:standalone)--cluster-type(optional): Type of instance to create for workspace management (Pro only)--project-uuid(optional): Project UUID for the new project
start - Start Mage Server and UI
Available in: ✅ OSS, ✅ Pro
Start the Mage server and web UI.
Usage:
project_path(optional): Path of the Mage project to be loaded (default: current directory)--host(optional): Specify the host (default:localhost)--port(optional): Specify the port (default:6789)--manage-instance(optional): Enable manage instance (default:0)--dbt-docs-instance(optional): Enable dbt docs instance (default:0)--instance-type(optional): Specify the instance type (default:server_and_scheduler)--project-type(optional): Create project of this type if it does not exist. Options:main,sub, orstandalone(default:standalone)--cluster-type(optional): Type of instance to create for workspace management (Pro only)--project-uuid(optional): Set project UUID for the repo that is being started
Pipeline Execution
run - Run Pipeline
Available in: ✅ OSS, ✅ Pro
Execute a pipeline or a specific block within a pipeline.
Usage:
project_path(required): Path of the Mage project that contains the pipelinepipeline_uuid(required): UUID of the pipeline to be run--test(optional): Specify if tests should be run (default:False)--block-uuid(optional): UUID of the block to be run (if not specified, runs entire pipeline)--execution-partition(optional): Execution partition identifier--executor-type(optional): Executor type to use--callback-url(optional): Callback URL for block execution--block-run-id(optional): Block run ID--pipeline-run-id(optional): Pipeline run ID--runtime-vars(optional): Runtime variables in JSON format. These will overwrite the pipeline global variables--skip-sensors(optional): Specify if the sensors should be skipped (default:False)--template-runtime-configuration(optional): Runtime configuration of data integration block runs (JSON format)
Maintenance Commands
clean_cached_variables - Clean Cached Variables
Available in: ✅ OSS, ✅ Pro
Clean up old pipeline run outputs based on retention period.
Usage:
project_path(required): Path of the Mage project to clean variables--pipeline-uuid(optional): UUID of the pipeline to clean (if not specified, cleans all pipelines)--retention-period(optional): Default retention period, e.g.,7d,2w(days or weeks)
clean_old_logs - Clean Old Logs
Available in: ✅ OSS, ✅ Pro
Clean up old pipeline run logs based on retention period.
Usage:
project_path(required): Path of the Mage project to clean old logs--pipeline-uuid(optional): UUID of the pipeline to clean (if not specified, cleans all pipelines)--retention-period(optional): Default retention period, e.g.,7d,2w(days or weeks)
Mage Pro Only Commands
The following commands are exclusively available in Mage Pro:clean_unused_blocks - Clean Unused Blocks
Available in: ❌ OSS, ✅ Pro
Clean up unused blocks from the given Mage project. This command interactively prompts you to delete blocks that are not referenced by any pipeline.
Usage:
project_path(required): Path of the Mage project--block-type(optional): The type of block to clean up (e.g.,data_loader,transformer,data_exporter)
y: Yes, delete the blockN: No, skip the blockc: Check content of the block before decidingq: Quit the operation
create_secret - Create or Update Secret
Available in: ❌ OSS, ✅ Pro
Create or update a secret for the given Mage project.
Usage:
project_path(required): Path of the Mage projectname(required): Name of the secretvalue(required): Value of the secret--update-exists(optional): Whether to update the secret if it already exists (default:True)
run_post_start_hooks - Execute Post-Start Hooks
Available in: ❌ OSS, ✅ Pro
Execute post-start hooks with graceful error handling. This command reads POST_START_COMMAND and POST_START_HOOK_PATH from environment variables if not provided as arguments.
Usage:
--post-start-command(optional): Post-start command to execute (JSON array or shell command string). Can also be set viaPOST_START_COMMANDenvironment variable--post-start-hook-path(optional): Path to post-start hook script file. Can also be set viaPOST_START_HOOK_PATHenvironment variable
restart_jobs - Restart Failed or Cancelled Pipeline Runs
Available in: ❌ OSS, ✅ Pro
Restart failed or cancelled pipeline runs with optional filters.
Usage:
project_path(required): Path of the Mage project to restart jobs from--pipeline-uuid(optional): UUID of the pipeline to filter jobs by--status(optional): Status filter:failed,cancelled, orboth(default:failed)--start-time(optional): Start time filter (ISO format:2024-01-01T00:00:00)--end-time(optional): End time filter (ISO format:2024-01-01T23:59:59)--limit(optional): Maximum number of jobs to restart (default:100)--skip-confirmation(optional): Skip confirmation prompt (default:False)
update_workspace - Update Workspace Configuration
Available in: ❌ OSS, ✅ Pro
Update a workspace configuration synchronously. The cluster type is determined by the CLUSTER_TYPE environment variable, defaulting to k8s if not set.
Usage:
workspace_name(required): Name of the workspace to update--project-path(optional): Path to the Mage project (defaults to current directory)--container-config(optional): YAML string for container configuration updates--update-workspace-settings/--no-update-workspace-settings(optional): Whether to update workspace settings with current cluster environment variables (default:False)
update_all_workspaces - Update All Workspaces
Available in: ❌ OSS, ✅ Pro
Update all workspaces in the cluster synchronously.
Usage:
--project-path(optional): Path to the Mage project (defaults to current directory)--container-config(optional): YAML string for container configuration updates--update-workspace-settings/--no-update-workspace-settings(optional): Whether to update workspace settings with current cluster environment variables (default:False)--cluster-type(optional): Type of cluster:k8sordocker(default:k8s)
re_add_workspace_routes - Re-add Workspace Routes to Ingress
Available in: ❌ OSS, ✅ Pro
Re-add workspace routes to the ingress. This is useful for Kubernetes deployments where workspace routes need to be refreshed.
Usage:
project_path(required): Path of the Mage project
recover_pipelines_from_file_versions - Recover Pipelines from File Versions
Available in: ❌ OSS, ✅ Pro
Recover pipelines from file versions. This command lists all pipelines that have file versions in the .file_versions folder and allows you to recover pipeline files from those versions.
Usage:
project_path(required): Path of the Mage project--pipeline-uuid(optional): UUID of the pipeline to recover. If not specified, all pipelines are processed--all/--no-all(optional): Recover all files automatically without confirmation. Uses the most recent version for each file (default:False)--verbose/-v(optional): Show detailed pipeline information including individual files and blocks (default:False)
Common Use Cases
Initializing a New Project
Running a Pipeline with Variables
Cleaning Up Old Data
Pro: Managing Secrets
Pro: Updating Workspace Configuration
Environment Variables
Some commands can be configured via environment variables:CLUSTER_TYPE: Cluster type for workspace operations (default:k8s)POST_START_COMMAND: Post-start command forrun_post_start_hooksPOST_START_HOOK_PATH: Post-start hook script path forrun_post_start_hooksENV_VAR_INSTANCE_TYPE: Instance type override forstartcommand
Additional Resources
- Mage OSS CLI Reference - Source code for OSS CLI commands
- Project Setup Guide - Learn how to set up a Mage project
- Workspaces Documentation - Learn about Mage Pro workspaces
Notes
- All paths can be absolute or relative to the current working directory
- JSON parameters should be properly escaped when used in shell commands
- Pro-only commands require appropriate cluster/workspace configuration
- Some commands may require database connections to be properly configured