Configuring and Using the obsutil CLI for Huawei Cloud Object Storage

obsutil is a command-line interface engineered for direct interaction with Huawei Cloud Object Storage Service (OBS). It enables developers and infrastructure engineers to manage storage buckets and manipulate object data without relying on web consoles or SDK implementations. The utility supports a wide range of operations, including bulk file transfers, directory synchronization, bucket lifecycle configuration, access policy management, and metadata retrieval. Advanced transfer capabilities such as multipart uploads, concurrent thread execution, and automatic breakpoint resumption ensure reliable data movement across unstable network conditions.

When integrating obsutil into local development environments or automated build pipelines, a frequent obstacle is the shell environment failing to locate the executable. This typically manifests as a command not found error when invoking the tool from custom scripts. The issue arises when the binary is extracted to a user-defined directory that has not been registered in the system's executable search path.

To resolve execution failures on macOS, the parent directory containing the obsutil binary must be appended to the PATH environment variable. Begin by verifying the executable's location and confirming it has the appropriate execution permissions:

ls -l /opt/cli_tools/huawei_obs/obsutil
chmod +x /opt/cli_tools/huawei_obs/obsutil

Next, configure the shell profile to persist the path across sessions. Modern macOS versions default to Zsh, while older setups or specific configurations may use Bash. Update the corresponding configuration file (~/.zshrc or ~/.bash_profile) with a conditional export to prevent duplicate path entries:

# Define the target directory
OBS_UTIL_HOME="/opt/cli_tools/huawei_obs"

# Conditionally prepend to PATH
if [[ ":$PATH:" != *":$OBS_UTIL_HOME:"* ]]; then
    export PATH="${OBS_UTIL_HOME}:${PATH}"
fi

After saving the configuration, apply the changes to the current terminal session:

# For Zsh
source ~/.zshrc

# For Bash
source ~/.bash_profile

Verify that the environment recognizes the command by checking the installed version:

obsutil --version

If the tool is invoked within an automated script (such as a deployment or asset synchronization routine), ensure the script executes in an environment where the updated PATH is available. For non-interactive shell executions, explicitly sourcing the profile at the beginning of the script or using the absolute path to the binary guarantees reliable execution. When configuring automated workflows, validate network connectivity and OBS credential settings before initiating large-scale trensfer operations to prevent authentication timeouts or permission denials.

Tags: Huawei Cloud OBS CLI Tools macOS Configuration devops

Posted on Fri, 17 Jul 2026 17:10:26 +0000 by JayFM