Skip to contents

macOS

Using Homebrew

  1. Install Homebrew if it’s not installed:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Update Homebrew package list:
brew update
  1. Install GSL
brew install gsl

Using MacPorts

  1. Install MacPorts if it’s not installed: Follow the installation guide on the MacPorts website.

  2. Update MacPorts package list:

sudo port selfupdate
  1. Install GSL:
sudo port install gsl

Compiling from Source

  1. Download the source code: Download the GSL source code from the official website.

  2. Unzip and navigate to the folder:

tar -xzf gsl-x.y.z.tar.gz
cd gsl-x.y.z

Replace x.y.z with the version number.

  1. Configure and make:
./configure
make
sudo make install

Windows

Installing the GNU Scientific Library (GSL) on Windows can be a bit more challenging compared to Linux or macOS.

Using MSYS2

  1. Install MSYS2: Download and install MSYS2 from the official site.

  2. Update Package Database and Core System Packages: Open MSYS2 and run the following commands to update the package database and core system packages.

pacman -Syu

After this, close MSYS2 and open it again.

  1. Update Remaining Packages: Run the following command to update the remaining packages:
pacman -Su
  1. Install GSL: To install GSL, run:
pacman -S mingw-w64-x86_64-gsl

Using vcpkg (For Visual Studio)

  1. Clone vcpkg: First, you’ll need to clone the vcpkg repository and then bootstrap it.
git clone https://github.com/microsoft/vcpkg
cd vcpkg
bootstrap-vcpkg.bat
  1. Install GSL: To install GSL, run:
vcpkg install gsl:x64-windows

Or for 32-bit,

vcpkg install gsl:x86-windows
  1. Integrate with Visual Studio: To integrate vcpkg libraries with Visual Studio, you can run:
vcpkg integrate install

Linux system

Ubuntu/Debian

Open your terminal and run:

sudo apt update
sudo apt install libgsl-dev

Fedora

sudo dnf install gsl-devel

CentOS/RHEL

For CentOS/RHEL, you can use the yum package manager:

sudo yum install gsl-devel

From Source

You can also compile GSL from source code on any Linux distribution:

  1. Download the source code: You can download the GSL source code from the official website.

  2. Extract and navigate to the folder:

tar -xzf gsl-x.y.z.tar.gz
cd gsl-x.y.z

Replace x.y.z with the version number.

  1. Configure, make, and install:
./configure
make
sudo make install

After installation, you should be able to use the GSL in your development projects. The library and header files are generally placed in standard locations (/usr/lib/, /usr/include/, etc.), so you should not need to make any special arrangements to use them in your projects.