| author | rwestMSFT |
|---|---|
| ms.author | randolphwest |
| ms.date | 08/15/2023 |
| ms.service | sql |
| ms.topic | include |
sqlcmd (Go) can be installed cross-platform, on Microsoft Windows, macOS, and Linux.
-
Install the Windows Package Manager Client if you don't already have it.
-
Run the following command to install sqlcmd (Go).
winget install sqlcmd
-
Install Chocolatey if you don't already have it.
-
Run the following command to install sqlcmd (Go).
choco install sqlcmd
-
Download the corresponding
-windows-x64.zipor-windows-arm.zipasset from the latest release of sqlcmd (Go) from the GitHub code repository. -
Extract the
sqlcmd.exefile from the downloaded zip folder.
-
Install Homebrew if you need to.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Install sqlcmd with Homebrew.
brew install sqlcmd
-
Download the
-darwin-x64.zipasset from the latest release of sqlcmd (Go) from the GitHub code repository. -
Extract the
sqlcmdfile from the downloaded zip folder.
-
Import the public repository GPG keys.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc -
Add the Microsoft repository, where the
ubuntu/20.04segment may bedebian/11,ubuntu/20.04, orubuntu/22.04.add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/prod.list)" -
Install sqlcmd (Go) with apt.
apt-get update apt-get install sqlcmd
-
Import the Microsoft repository key.
rpm --import https://packages.microsoft.com/keys/microsoft.asc
-
Download the repository configuration file, where the
centos/8segment may becentos/8,fedora/32,opensuse/42.3,rhel/8, orsles/15. If the version of your OS doesn't directly correspond to one of those options, you can likely successfully use a repository configuration file from a version. For example,centos/8can be used in an environment running CentOS 7.curl -o /etc/yum.repos.d/packages-microsoft-com-prod.repo https://packages.microsoft.com/config/centos/8/prod.repo
-
Install sqlcmd (Go) with yum.
yum install sqlcmd
-
Download the corresponding
-linux-x64.tar.bz2or-linux-arm.tar.bz2asset from the latest release of sqlcmd (Go) from the GitHub code repository. -
Extract the
sqlcmdfile from the downloaded zip folder.