# Mac (Intel and Silicon)

### Overview

This guide outlines the steps to install the L1X Cargo plugin for Mac within the L1X SDK environment. The process includes setting up your environment, installing necessary tools, and configuring Cargo for L1X.

### Pre-requisites

#### Install Homebrew

First, install Homebrew, which is necessary for managing packages on macOS.

```bash
/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"

```

#### Install LLVM 15 (WASM to LLVM-IR Dependency by Inkwell)

LLVM version 15 is required, and it can be installed via Homebrew. Note that this is a keg-only version.

```bash
brew install llvm@15

```

#### Configure Environment Variables for LLVM 17

Since LLVM 15 is keg-only and not symlinked into `/opt/homebrew`, you'll need to adjust your environment variables to use LLVM 15 explicitly.

#### Set PATH for LLVM

This ensures that the system uses LLVM 17's binaries.

```bash
echo 'export PATH="/opt/homebrew/opt/llvm@15/bin:$PATH"' >> ~/.zshrc

```

#### Configure Compiler and Linker Flags

To use the bundled libc++, set the following LDFLAGS and include directory settings:

```bash
export LDFLAGS="-L/opt/homebrew/opt/llvm@15/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@15/lib/c++"
export LDFLAGS="-L/opt/homebrew/opt/llvm@15/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm@15/include"

```

#### Install LLVM 17 (To Build Object File)

LLVM version 17 is required, and it can be installed via Homebrew. Note that this is a keg-only version.

```bash
brew install llvm@17

```

#### Configure Environment Variables for LLVM 17

Since LLVM 17 is keg-only and not symlinked into `/opt/homebrew`, you'll need to adjust your environment variables to use LLVM 17 explicitly.

#### Set PATH for LLVM

This ensures that the system uses LLVM 17's binaries.

```bash
echo 'export PATH="/opt/homebrew/opt/llvm@17/bin:$PATH"' >> ~/.zshrc

```

#### Configure Compiler and Linker Flags

To use the bundled libc++, set the following LDFLAGS and include directory settings:

```bash
export LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@17/lib/c++"
export LDFLAGS="-L/opt/homebrew/opt/llvm@17/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm@17/include"

```

#### Make LLVM17 as Default

```bash
brew link --overwrite llvm@17  # Makes LLVM 17 the default

```

Install Cargo L1X Plugin

The L1X plugin for Cargo is essential for managing L1X-specific tasks in your Rust projects.

```bash
cargo install cargo-l1x --force

```

### Create Project from a Template

Use a template to quickly start a new project with pre-configured settings.

```bash
cargo l1x create some_project --template ft

```

### Build Project

Navigate to your project directory and build the project to ensure everything is set up correctly.

```bash
cd some_project
cargo l1x build

```



In case you have any issues with the above pre-requisites, please install the below dependencies.&#x20;

```bash
brew install pkg-config
brew install openssl
brew install zlib

```



