Salesforce CLI configuration for Mac

city skyline during golden hour
Reading Time: 2 minutes

Configuring the Salesforce CLI (Command Line Interface) on Mac can seem like a tedious task. However, it doesn’t have to be! There are simple steps you can follow to ensure that your Salesforce CLI is configured correctly for Mac. This post will outline the steps needed to successfully configure the Salesforce CLI on Mac.

The Salesforce CLI is a powerful tool that helps you develop, customize, and enhance your Salesforce applications. The CLI offers several commands that can be used to create, configure, update, deploy, and delete metadata components. The Salesforce CLI can be used on both Windows and Mac operating systems.

This guide will walk you through the steps you need to take to configure the Salesforce CLI for Mac.

Download the Salesforce DX CLI

Download from https://developer.salesforce.com/tools/sfdxcli and install it as any other mac application

Check installation. Open your terminal and type:

$ sfdx version

$ sfdx help

You can ask for help on an specific command. For example, let’s ask how auth command works:

$ sfdx auth --help

Authenticate the Salesforce CLI.

$ sfdx auth

Select:

$ auth web login


Follow the OAuth steps. This will open a browser window from which you can log in. Once you’re done, you can use the. rest of the commands available in the SFDX CLI tool.

Once the authentication is done, you can close the tab and go to the command line to see:

$ Successfully authorized my@username.dev with org ID 00A9V000001wCajUAB

To start downloading metadata c reate Salesforce DX project in your local machine:

$ sfdx force:project:create -n myProject --manifest

The above command will create the default project structure for a typical Salesforce DX project.

Now let’s download one Apex class:

$ sfdx force:source:retrieve -m "ApexClass:MyApexClass" -u myuser@something.dev

Now let’s make some modifications to your Apex class to deploy the changes to your dev org. Type:

$ sfdx force:source:deploy -m "ApexClass:MyApexClass" -u myuser@something.dev

Configure Visual Studio Code to use Salesforce CLI

There are several Visual Studio Code plugins available to make it easier to use Salesforce CLI in your development process. You can install these plugins and configure them to use your Salesforce org.

Take a look at this guide to configure it: https://www.apexhours.com/how-to-setup-visual-studio-code-for-salesforce/

How to update the Salesforce CLI

$ sfdx update
,

About the author

Andrés Canavesi
Andrés Canavesi

Software Engineer with 15+ experience in software development, specialized in Salesforce, Java and Node.js.


Related posts


Leave a Reply

%d bloggers like this: