Installation of Homebrew on macOS


Paste that in a macOS Terminal. This script will explain what it will do, and you can read it carefully.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Append Homebrew to your .zprofile:

This command adds the initialization script for Homebrew to the .zprofile, which is executed whenever a new shell session starts on your macOS. This ensures that Homebrew’s environment settings are initialized with every new terminal session.

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/kashifmanzoor/.zprofile

Execute the Homebrew environment script:

This command immediately initializes the Homebrew environment in your current terminal session without needing to restart the terminal. This allows you to use Homebrew right away.bashCopy codeeval "$(/opt/homebrew/bin/brew shellenv)"

eval "$(/opt/homebrew/bin/brew shellenv)"

Run these commands separately in your terminal to properly configure Homebrew.

Install the Oracle Cloud Infrastructure CLI

Follow these steps to install the Oracle Cloud Infrastructure (OCI) CLI on macOS. The CLI lets you interact with Oracle Cloud resources and services through your terminal. With Homebrew installed, you can now proceed to install the OCI CLI using Homebrew by running the following command:

brew install oci-cli

Verify Installation

Once the installation is complete, verify that the CLI is installed correctly by checking the version. This command also ensures that the CLI is operational:

oci --version

Configuration Setup

oci setup config

Create API Signing Key if Missing

If the file truly doesn’t exist because it hasn’t been created yet, you’ll need to generate a new API Signing key pair. Here’s how you can do it:

  1. Generate the key pair:
openssl genrsa -out /Users/name/ocikey.pem 2048

Generate the public key from the private key:

openssl rsa -pubout -in /Users/name/ocikey.pem -out /Users/name/ocikey_public.pem

Set the correct permissions for the private key:

chmod 600 /Users/name/ocikey.pem

Test Your Setup

To confirm that your OCI CLI is configured correctly and can communicate with Oracle Cloud, run a simple command like listing your compartments: If everything is set up correctly, this command will return a list of your compartments in JSON format.

oci iam compartment list

The OCI CLI command oci os ns get is used to retrieve the namespace for your Oracle Cloud Infrastructure Object Storage service. In Oracle Cloud Infrastructure, a namespace is a unique identifier that serves as the top-level container for all your Object Storage resources within your Oracle Cloud account.

What Does the Namespace Represent?

The namespace is essentially a partition in Oracle Cloud where your Object Storage resources (buckets and objects) are stored. Each Oracle Cloud account has one unique namespace that spans all regions and is tied to the tenancy. The namespace is automatically assigned to your account when it is created.

How is the Namespace Used?

  • Bucket Identification: In Oracle Cloud Object Storage, every bucket name must be unique within a namespace but not across namespaces. Different tenants can have buckets with the same name, but each bucket name must be unique within a single tenant’s namespace.
  • Resource Access: The namespace is part of the resource identifier (URI) for accessing objects stored in the Object Storage via APIs, SDKs, or CLI.
  • Data Isolation: The namespace acts as a top-level isolation layer, ensuring that data storage structures are logically separated from those of other tenants.

Example Usage of oci os ns get

To use this command, you would typically run it from your terminal after configuring the OCI CLI with your credentials. The command returns the namespace associated with your tenancy. Here’s how you can execute it:

oci os ns get

The output will typically look something like this:

{
  "data": "an_example_namespace"
}

Here, an_example_namespace would be the namespace assigned to your tenancy. This value is crucial when constructing paths for API calls or managing storage resources programmatically or from the CLI.

Why is Knowing Your Namespace Important?

Knowing your namespace is essential for performing any operations related to object storage in OCI, including creating buckets, uploading objects, or setting up cross-region replication. It is often required in API endpoints and scripting scenarios where you must manage your cloud resources programmatically.

To list the buckets in a specific compartment within Oracle Cloud Infrastructure (OCI) Object Storage using the OCI CLI, you use the oci os bucket list command. This command requires you to specify the compartment ID where the buckets are located. Optionally, you can specify additional parameters like filtering by name, limiting the number of buckets returned, or specifying the region if your configuration file does not specify it.

Here’s how you can construct and run this command:

Basic Command Structure

oci os bucket list --compartment-id <COMPARTMENT_ID>
Replace <COMPARTMENT_ID> with the actual ID of the compartment for which you want to list the buckets.
oci os bucket list --compartment-id ocid1.compartment.oc1..exampleuniqueID