Simplified Way to Install Sqlpackage on macOS using dotnet
Table of Contents
Introduction
Installing sqlpackage on a Mac used to be a bit of a pain because of the security constraints that occur because Microsoft do not sign their packages properly and I wrote about working around those complexities in 2023. But we can just install it using dotnet which makes all those issues go away.
Prerequisites
Before installing sqlpackage, you will need to have dotnet sdk isntalled. The simplest way to install that is via homebrew:
brew install dotnet-sdk --cask
Install sqlpackage
Once you have dotnet installed, you can install sqlpackage using the following command:
dotnet tool install -g microsoft.sqlpackage
You may end up with a message warning you that the ~/.dotnet/tools
path is not in the PATH environment variable and it will provide you with a command to add it.
Cleaning up old installations
If you have previously installed sqlpackage using the old method, you can remove it by running the following command:
rm -rd ~/.sqlpackage
And you will also want to remove the path from your bash / zsh / pwsh profiles.
Update sqlpackage
To update sqlpackage, you can run the following command:
dotnet tool update -g microsoft.sqlpackage