Installing the Glasgow Haskell Compiler and Cabal
Last updated
Last updated
To compile Cardano Node using source code, you must install the Glasgow Haskell Compiler (GHC) and Cabal for building applications and libraries.
For each Cardano Node release, Input-Output recommends compiling binaries using specific versions of GHC and Cabal. For example, refer to in the to determine the GHC and Cabal versions required for the current Cardano Node release. Table 1 lists GHC and Cabal version requirements for the current Cardano Node release.
Table 1 Current Cardano Node Version Requirements
April 2025
10.3.1
10.7.0.0
9.6.7
3.12.1.0
To install GHC and Cabal:
1. In a terminal window on the computer hosting your block-producing node, to install the latest versions of all previously installed packages assuming the answer yes
to all prompts, type:
2. To install packages and tools required for downloading and compiling Cardano Node source code, type:
3. To use the GHCup installer to install GHC and Cabal, type:
4. During installation, when prompted:
i. Press ENTER to proceed.
ii. To prepend the required PATH variable to $HOME/.bashrc
, type P
iii. When prompted to install haskell-language-server (HLS), type N
iv. When prompted to install stack, type N
v. Press ENTER to proceed.
5. When GHCup finishes installing GHC and Cabal, type the following commands to reload your shell profile, and then confirm that GHCup installed correctly:
6. To set the Glasgow Haskell Compiler to the version required for compiling the current Cardano Node release, type the following commands where <GHCVersionNumber>
is the GHC version that you need to install and use:
7. To set Cabal to the version required for compiling the current Cardano Node release, type the following commands where <CabalVersionNumber>
is the Cabal version that you need to install and use:
8. To create a working directory to store source code and builds related to Cardano Node, type:
9. To download, compile and install libsodium
, type:
10. To download, compile and install libsecp256k1
, type:
11. To download and install the blst
library, type:
12. Using a text editor, open the $HOME/.bashrc
file, and then add the following lines at the end of the file:
13. Save and close the $HOME/.bashrc
file.
14. To create the folder set for the NODE_HOME
environment variable in your $HOME/.bashrc
file, type:
15. To reload your shell profile, type:
16. On each computer hosting a relay or block-producing node for your stake pool, repeat steps 1 to 15
If you plan to use your Cardano node on a testnet network instead of mainnet, then replace the line export NODE_CONFIG="mainnet"
in your $HOME/.bashrc
file with export NODE_CONFIG="testnet"
Also, when working through the How to Set Up a Cardano Stake Pool guide, replace every instance of the command option --mainnet
with --testnet-magic <MagicNumber>
where <MagicNumber>
is the network magic number for the testnet network that you want to use. For details on available testnet networks, see .