Skip to content

Instantly share code, notes, and snippets.

@vkeenan
Last active February 1, 2022 18:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkeenan/3979eb1128d9bc0407fcfa82a8df1e2c to your computer and use it in GitHub Desktop.
Save vkeenan/3979eb1128d9bc0407fcfa82a8df1e2c to your computer and use it in GitHub Desktop.
How to Install SFDX-CLI on Ubuntu 20.04 with Autocomplete using NVM
# How to Install SFDX-CLI on Ubuntu 20.04 with Autocomplete using NVM
#
# By: Vernon Keenan, vern@vernonkeenan.com, https://salesforcedevops.net, https://github.com/vkeenan
#
# Install the following for a full SFDX-CLI installation:
#
# * Zsh shell
# * Oh My Zsh shell enhancement
# * NVM NodeJS verison manager
# * Lastest LTS versions of NodeJS and NVM
# * SFDX-CLI autocompletion database from @wadewegner
#
# Paste these lines one-at-time in user context on a fresh Ubuntu 20.04 installation
#
# Install Zsh
#
sudo apt install zsh -y
chsh -s $(which zsh)
#
# Logout and log back in
#
logout
#
# Upon login, answer the Zsh question with "0"
#
# Install Oh My Zsh
#
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
exit
#
# reload Zsh configuration
#
source ~/.zshrc
#
# configure Oh My Zsh
#
sed -i 's/robbyrussell/agnoster/' ~/.zshrc
sed -i 's/plugins=(git)/plugins=(git salesforce-cli-zsh-completion)/' ~/.zshrc
#
# update SFDX-CLI autocomplete database
#
git clone git@github.com:wadewegner/salesforce-cli-zsh-completion.git ~/.oh-my-zsh/custom/plugins/salesforce-cli-zsh-completion
source ~/.zshrc
#
# install nvm
#
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | zsh
source ~/.zshrc
#
# install NodeJS v14 and NPM v6
#
nvm install --lts
#
# install SFDX-CLI with minimal security issues
#
npm install sfdx-cli -g
source ~/.zshrc
#
# test basic SFDX-CLI installation
#
sfdx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment