Setup CLI Initial Configuration
If you are using the CLI to try things out on-chain, you will need to configure the network, faucet, and credentials you want the CLI to use.
This makes using the CLI easier and more secure as you will not be forced to repeatedly copy addresses or private keys.
⚠️
If you still need to install the CLI, follow these steps.
Run
aptos init
and follow the instructions in the command line.
ℹ️
To use default settings, you can provide no input and just press “Enter”. For example:
Output
Later, if you want to update these settings, you can do so by running
aptos init
again.The rest of these configuration steps are optional / quality of life. To continue to use the CLI for your specific use case, follow the usage guide here.
(Optional) Creating Named Configurations (Profiles)
For testing more complicated scenarios, you will often want multiple accounts on-chain. One way to do this is to create a named configuration which we call a profile.
To create a profile, run aptos init --profile <name_of_profile>
. The configuration you generate will be usable when calling CLI commands as replacements for arguments.
For example:
Output
(Optional) Setting Up Shell Completion
One quality of life feature you can enable is shell auto-completions.
Determine which shell you are using (you can run
echo $SHELL
if you are unsure).Look up where configuration files for shell completions go for that shell (it varies from shell to shell). The supported shells are
[bash, zsh, fish, PowerShell, elvish]
.Run the following command with your specific shell and the output file for completions using your shell:
Example command for oh my zsh
:
(Optional) Global Config
By default, the CLI will look for a configuration in .aptos/config.yaml
in each workspace directory. If you would like to use a shared configuration for all workspaces, you can follow these steps:
Create a folder in your home directory called
.aptos
(so it has the path~/.aptos
).Create a yaml file inside
.aptos
calledglobal_config.yaml
.Run the command:
You should see:
Last updated