# Starknet Cairo Development Environment Setup
This guide explains how to set up a development environment for Starknet using the Cairo programming language.
## Prerequisites
- Linux/Unix-based system (Ubuntu is recommended)
- Python 3.9 or higher
- Git
- Rust and Cargo
## Installation Steps
### 1. Install Rust and Cargo
Run the following command to install Rust and Cargo:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
```
### 2. Install Cairo Language
Download and install Cairo:
```bash
curl -L https://github.com/cairo-lang/cairo/releases/download/v2.5.3/cairo-2.5.3-ubuntu-22.04.deb -o cairo.deb
sudo dpkg -i cairo.deb
```
### 3. Install Python Dependencies
Upgrade pip and install the Cairo Python library:
```bash
python3 -m pip install --upgrade pip
python3 -m pip install cairo-lang
```
### 4. Install Scarb (Cairo Package Manager)
Install Scarb, a package manager for Cairo:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh
```
### 5. Install VSCode Extensions
Install the following extensions for better development experience:
Cairo: For syntax highlighting and language support.
Cairo Test Runner: For running tests directly from VSCode.
### 6. Configure Environment Variables
Add Cairo to your PATH by adding this line to your ~/.bashrc or ~/.zshrc file:
```bash
export PATH="$PATH:/path/to/cairo/bin"
```
### 7. Verify Installation
Check if Cairo and Scarb are installed correctly:
```bash
cairo-compile --version
scarb --version
```
### Additional Tools and Resources
Starknet CLI
Install Starknet CLI tools:
```bash
pip install starknet-devnet
pip install starknet-py
```
### Useful Development Tools
Starknet Devnet: Local Starknet development network.
Protostar: Framework for managing Cairo projects and running tests.
Nile: Command-line tool for Starknet development.
Troubleshooting
If you run into any issues:
Make sure all prerequisites are installed.
Check if the environment variables are set correctly.
Consult the official Cairo documentation for more help.
Resources
- Official Cairo Documentation
- Starknet Documentation
- Cairo Book