Logo

dev-resources.site

for different kinds of informations.

How to Install Foundry on Windows/macOS/Linux

Published at
11/15/2024
Categories
blockchain
web3
foundry
ethereum
Author
awesamarth
Categories
4 categories in total
blockchain
open
web3
open
foundry
open
ethereum
open
Author
10 person written this
awesamarth
open
How to Install Foundry on Windows/macOS/Linux

Introduction

If you are a web3 developer, I'm sure you must have heard of Foundry somewhere- maybe in a YouTube video, maybe in a Twitter thread, or maybe from a friend of yours. Foundry is a smart contract development toolchain. You can write, compile, deploy and test smart contracts as well as interact with them using Foundry.

Foundry vs Remix IDE

You may be asking yourself: why should I choose Foundry over Remix IDE? Well, first of all, Foundry is installed locally on your system. So if you're making, let's say, a website, you can initialize a Foundry project alongside your other files and then make changes there directly. This allows you to structure your files in an organized manner and work quickly. Moreover, Remix can be pretty unreliable sometimes and you might end up losing all your progress unexpectedly. Most importantly however, Foundry shines through with its testing suite which allows you test your contracts significantly faster than Remix and it thus provides a seamless development experience.

OK enough yapping. Now without further ado, let's see how we can install this Swiss Army Knife on our machines.

Installing on Linux/macOS

If you have Linux or macOS, the process is pretty straightforward.

First download Foundryup, which is the official installer for the Foundry toolchain, by running this command in your terminal

curl -L https://foundry.paradigm.xyz | bash
Enter fullscreen mode Exit fullscreen mode

Follow the on-screen instructions and the foundryup command will become available in your terminal. Then, just run:

foundryup
Enter fullscreen mode Exit fullscreen mode

This will automatically install the latest (nightly) versions of the: forge, cast, anvil, and chisel tools, which are a part of Foundry.

And that's pretty much it lmao. Linux users have it easy this time. A welcome change, I'm sure. Jump to the Did it work section.

Installing on Windows

You can just use WSL and then refer to the commands in the previous section. However, if you don't want to install WSL, read on.

Make sure you have the Rust compiler and Cargo already installed on your machine. If you don't, download rustup from this link and run it to install both. You'll also need a recent version of Visual Studio, with the Desktop Development With C++ workload installed. Rustup will prompt you to install it. This is what you'll see when you run the downloaded file:

Enter 1 here

Enter 1 here and let the setup run

Once Visual Studio is installed, you will get this screen:

(just press enter here)

If everything is successful, you will get something like this:

Awesome! Now press enter, relaunch your terminal and run this command

cargo install --git https://github.com/foundry-rs/foundry --profile release --locked forge foundry-cast chisel anvil
Enter fullscreen mode Exit fullscreen mode

This command will install the Foundry suite, ie. Forge, Cast, Anvil and Chisel on your machine. This might take some time as it will download and compile multiple crates. This will happen for all 4 tools so grab a cup of coffee or something while you wait. Once that is done, you'll see:

💡

Don't worry if it seems stuck at any point

Did it work?

To check if it worked, relaunch your terminal and run these commands one by one. Each should give you some output

forge --version

anvil --version

chisel --version

cast --version
Enter fullscreen mode Exit fullscreen mode

The output should be something like this:

Conclusion

Congratulations, you've successfully installed Foundry on your machine! In the next instalment of this series, we'll see how we can create a new Foundry project and write smart contracts in it. Stay tuned till then. Bye for now! 👋👋

foundry Article's
24 articles in total
Favicon
Mainnet Forking in Foundry
Favicon
Foundry tutorial para inciantes
Favicon
How to deploy smart contracts using Foundry
Favicon
The best way to import your private key in Foundry
Favicon
Streamline Your Smart Contract Development with Foundry
Favicon
Developer’s Guide to ERC-4337 #1 | Developing Simple Account
Favicon
How to write and compile smart contracts in Foundry
Favicon
How to Install Foundry on Windows/macOS/Linux
Favicon
Build a Multi-Payment DApp on Morph with Foundry
Favicon
How I Built a Decentralized Crowdfunding App with Foundry(incl. unit tests)
Favicon
Cómo desplegar y verificar un contrato inteligente en la blockchain de Mode usando Foundry
Favicon
How to Deploy and Verify a Smart Contract on Mode's Blockchain using Foundry
Favicon
Ethereum Development: Foundry or Hardhat
Favicon
Deploy Upgradeable Smart Contracts with Foundry and OpenZeppelin
Favicon
Foundry - chisel
Favicon
Introduction to smart contract development using Foundry
Favicon
Foundry Test : ERC721 SOL (Postmortem)
Favicon
Deploy a smart contract to an arbitrary address
Favicon
Installing foundry toolchain on windows.
Favicon
Setup Smart Contract Development with Foundry and Thirdweb
Favicon
Compiling and testing Vyper contract using Foundry
Favicon
Foundry – Solidity Tests, Fuzzing and so much more!
Favicon
Foundry Vs Hardhat
Favicon
使用Foundry,感受快,rust对写合约的支持

Featured ones: