Apt-get For Macos

  • Notably, APT automatically gets and installs packages upon which the indicated package depends (if necessary). This was an original distinguishing characteristic of APT-based package management systems, as it avoided installation failure due to missing dependencies, a type of dependency hell.
  • This is similar to the homebrew command in MacOS. By using yum, dnf, apt-get, etc., you're basically adding a repository and updating the package cache. Download, compile, and build it yourself This usually involves downloading a package directly from a website or using the wget command and running the configuration file and Makefile to install.
-->

Applies to:SQL Server (all supported versions) - Linux

The following steps install the command-line tools, Microsoft ODBC drivers, and their dependencies. The mssql-tools package contains:

  • sqlcmd: Command-line query utility.
  • bcp: Bulk import-export utility.

Install the tools for your platform:

It is possible to use apt-get on OS X 10.9 like Deb based Linux using a third party software named Fink - How to Install apt-get on Mac OS X. However, unlike Homebrew and OS X Package Managers, Fink does not use /usr/local/ path to install software.

This article describes how to install the command-line tools. If you are looking for examples of how to use sqlcmd or bcp, see the links at the end of this topic.

Install tools on RHEL 8

Use the following steps to install the mssql-tools on Red Hat Enterprise Linux.

  1. Enter superuser mode.

  2. Download the Microsoft Red Hat repository configuration file.

  3. Exit superuser mode.

  4. If you had a previous version of mssql-tools installed, remove any older unixODBC packages.

  5. Run the following commands to install mssql-tools with the unixODBC developer package.

    Note

    To update to the latest version of mssql-tools run the following commands:

  6. Optional: Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell.

    To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

    To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

Install tools on Ubuntu 16.04

Use the following steps to install the mssql-tools on Ubuntu.

Note

Ubuntu 18.04 is supported starting with SQL Server 2019 CU3. If you are using Ubuntu 18.04, change the repository path from /ubuntu/16.04 to /ubuntu/18.04.

  1. Import the public repository GPG keys.

  2. Register the Microsoft Ubuntu repository.

  3. Update the sources list and run the installation command with the unixODBC developer package.

    Note

    To update to the latest version of mssql-tools run the following commands:

  4. Optional: Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell.

    To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

    To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

Install tools on SLES 12

Use the following steps to install the mssql-tools on SUSE Linux Enterprise Server.

  1. Add the Microsoft SQL Server repository to Zypper.

  2. Install mssql-tools with the unixODBC developer package.

    Note

    To update to the latest version of mssql-tools run the following commands:

  3. Optional: Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell.

    To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command:

    To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command:

Install tools on macOS

A preview of sqlcmd and bcp is now available on macOS. For more information, see the announcement.

Install Homebrew if you don't have it already:

  • /usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'

To install the tools for Mac El Capitan and Sierra, use the following commands:

Docker

If you run SQL Server in a Docker container, the SQL Server command-line tools are already included in the SQL Server Linux container image. If you attach to a running container with an interactive bash shell, you can run the tools locally.

Offline installation

Apt-get For Macos Mac

If your Linux machine does not have access to the online repositories used in the previous sections, you can download the package files directly. These packages are located in the Microsoft repository, https://packages.microsoft.com.

Tip

If you successfully installed with the steps in the previous sections, you do not need to download or manually install the package(s) below. This is only for the offline scenario.

  1. First, locate and copy the mssql-tools package for your Linux distribution:

    Linux distributionmssql-tools package location
    Red Hathttps://packages.microsoft.com/rhel/7.3/prod
    SLEShttps://packages.microsoft.com/sles/12/prod
    Ubuntu 16.04https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/mssql-tools
  2. Also locate and copy the msodbcsql package, which is a dependency. The msodbcsql package also has a dependency on either unixODBC-devel (Red Hat and SLES) or unixodbc-dev (Ubuntu). The location of the msodbcsql packages are listed in the following table:

    Linux distributionODBC packages location
    Red Hathttps://packages.microsoft.com/rhel/8/prod
    SLEShttps://packages.microsoft.com/sles/12/prod
    Ubuntu 16.04msodbcsql
    unixodbc-dev
  3. Move the downloaded packages to your Linux machine. If you used a different machine to download the packages, one way to move the packages to your Linux machine is with the scp command.

  4. Install the and packages: Install the mssql-tools and msodbc packages. If you get any dependency errors, ignore them until the next step.

    PlatformPackage install commands
    Red Hatsudo yum localinstall msodbcsql-<version>.rpm
    sudo yum localinstall mssql-tools-<version>.rpm
    SLESsudo zypper install msodbcsql-<version>.rpm
    sudo zypper install mssql-tools-<version>.rpm
    Ubuntusudo dpkg -i msodbcsql_<version>.deb
    sudo dpkg -i mssql-tools_<version>.deb
  5. Resolve missing dependencies: You might have missing dependencies at this point. If not, you can skip this step. In some cases, you must manually locate and install these dependencies.

    For RPM packages, you can inspect the required dependencies with the following commands:

    For Debian packages, if you have access to approved repositories containing those dependencies, the easiest solution is to use the apt-get command:

    Note

    This command completes the installation of the SQL Server packages as well.

    If this does not work for your Debian package, you can inspect the required dependencies with the following commands:

Next steps

For an example of how to use sqlcmd to connect to SQL Server and create a database, see one of the following quickstarts:

Apt-get For MacosApt-get For Macos

For an example of how to use bcp to bulk import and export data, see Bulk copy data to SQL Server on Linux.

The current stable version of ack is v3.4.0, released 2020-06-29.

What's changed in ack? See the ack changelog.

Ack is highly portable, and will run on any machine running Perl 5.10.1 or higher.

Install ack via Perl CPAN module

If you use Perl regularly, you can install ack's module, App::Ack.

Installing via CPAN shell means that the shell can automatically tell you when ack has updates. The CPAN is also the primary distribution channel for ack. All packages below derive from here.

Install the ack executable

The single-file version of ack is a single Perl program, around 5,400 lines of plain text. It combines the ack program and all its Perl modules into a single text file you can download and install anywhere you can put a shell script. If you don't have sysadmin rights on your machine, or don't want to mess with setting up the CPAN system, this is the way to go.

# NOTE: This URL is https, not http as it was pre-2017.
curl https://beyondgrep.com/ack-v3.4.0 > ~/bin/ack && chmod 0755 ~/bin/ack

Is your curl install not working? Please check that your are using the https scheme, not http. This site switched to HTTPS in early 2017.

Install a package for your specific OS

ack has been repackaged for most Linux distributions and OS X. On Debian-derived distributions, it is called 'ack-grep' because 'ack' was already a package for Kanji translation.

Please note that the maintainers of ack have nothing to do with these packages. If a given package is out of date or doesn't work, you'll need to work with the packagers, not the ack team.

macOS

Fink
Package 'ack'
Homebrew
Formula 'ack'
Macports
Port 'perl/p5-app-ack'

Windows

Chocolatey
https://chocolatey.org/packages/ack
Scoop
App 'ack'

*BSD

FreeBSD port
Port 'textproc/ack'
OpenBSD port
Package 'p5-ack'

Linux

Arch
Package 'community/ack'
Centos
Package 'ack' in EPEL repository
Debian
Package 'ack-grep'
(To rename the 'ack-grep' program to its proper name 'ack', see the section below on renaming ack-grep)
Fedora
Package 'ack'
Gentoo
Package 'sys-apps/ack'
NixOS
Package 'perl-ack'
Sabayon
Package 'sys-apps/ack'
Ubuntu
Package 'ack-grep'

Renaming ack-grep on Debian-derived distros

Apt-get For Macos 10

This section probably won't be necessary as latest releases of 'ack-grep' package provide both 'ack' and 'ack-grep' commands. If for some reason the package you're using installs ack as ack-grep, here's what to do.

On Debian-derived distros, ack is packaged as 'ack-grep' because 'ack' already existed. If you simply install via:

$ sudo apt-get install ack-grep

your ack will be called 'ack-grep', which is 167% more characters to type per invocation. This is tragic for your poor fingers.

To create a local diversion, renaming ack-grep to ack, first install the ack-grep package as shown above. Then, run:

$ sudo dpkg-divert --local --divert /usr/bin/ack --rename --add /usr/bin/ack-grep

Is there another distro we should list? Let me know at andy@petdance.com.

On May 27, 2019, ack v3.0.0 was released. We urge all ack users to upgrade.

Although ack 1.x and 2.x are no longer being maintained, and there will be no new releases, you can still download the latest of each.

curl https://beyondgrep.com/ack-2.28-single-file > ~/bin/ack && chmod 0755 !#:3
curl https://beyondgrep.com/ack-1.96-single-file > ~/bin/ack && chmod 0755 !#:3

Mac Apt

We still have the ack 2.28 manual and ack 1.96 manual.