How to Set up Claude Code Natively

How to Set up Claude Code Natively

Below is the process to set up Claude Code on your computer.

  1. Open Terminal

  2. Install Claude Code by running: curl -fsSL https://claude.ai/install.sh | bash

  3. Run: nano ~/setup-claude-mac.sh

  4. Paste in the following script (which is also available on https://utexas.sharepoint.com/sites/AIStudio/SitePages/Getting-Started-with-Claude-Code.aspx?CT=1776970062846&OR=OWA-NT-Mail&CID=b7f143d3-d777-e9d0-87f3-fd195be59bb9):

 

#!/bin/bash

# setup-claude-mac.sh

 

CLAUDE_PATH=$(which claude 2>/dev/null)

if [ -z "$CLAUDE_PATH" ]; then

    echo "Error: Claude Code not found in PATH"

    echo ""

    echo "Please install Claude Code first:"

    echo "  curl -fsSL https://claude.ai/install.sh | bash"

    echo ""

    echo "Then close and reopen your terminal, and run this script again."

    exit 1

fi

 

echo "Found Claude Code at: $CLAUDE_PATH"

echo ""

 

if [ -f ~/.claude/settings.json ]; then

    BACKUP_FILE=~/.claude/settings.json.backup.$(date +%Y%m%d_%H%M%S)

    cp ~/.claude/settings.json "$BACKUP_FILE"

    echo "Backed up existing settings to: $BACKUP_FILE"

    echo ""

fi

 

mkdir -p ~/.claude

echo "Verified ~/.claude directory exists"

echo ""

 

echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

echo "Configuration Setup"

echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"

echo ""

 

read -s -p "Enter your Portkey API key: " API_KEY

echo ""

if [ -z "$API_KEY" ]; then

    echo "Error: API key cannot be empty"

    exit 1

fi

 

read -p "Enter your integration slug (found in Model Catalog): " SLUG

echo ""

if [ -z "$SLUG" ]; then

    echo "Error: Slug cannot be empty"

    exit 1

fi

 

read -p "Enter the model that is enabled for your API key (e.g., haiku): " MODEL_INPUT

echo ""

if [ -z "$MODEL_INPUT" ]; then

    echo "Error: Model cannot be empty"

    exit 1

fi

 

cat > ~/.claude/settings.json << EOF

{

  "env": {

    "ANTHROPIC_BASE_URL": "https://api.portkey.ai",

    "ANTHROPIC_AUTH_TOKEN": "dummy",

    "ANTHROPIC_CUSTOM_HEADERS": "x-portkey-api-key: ${API_KEY}\\nx-portkey-provider: @${SLUG}"

  },

  "model": "${MODEL_INPUT}"

}

EOF

 

echo "Configuration saved to ~/.claude/settings.json"

 

cat << EOF > ~/.claude.json

{

  "hasCompletedOnboarding": true

}

EOF

 

echo "Created ~/.claude.json with onboarding settings"

echo ""

echo "Your Claude Code installation is now configured to use:"

echo "Portkey API at: https://api.portkey.ai"

echo ""

echo "You can now use 'claude' command normally."

echo ""

 

  1. Save this script by pressing Ctrl + O (letter O not zero), and then press Enter

  2. Exit by pressing Ctrl + X

  3. Run: ls -l ~/setup-claude-mac.sh

  4. Run: chmod +x ~/setup-claude-mac.sh

  5. Run: ~/setup-claude-mac.sh 

  6. Enter your Portkey API key, which can be found on PortKey under “API Keys” (Read here about how to get your UT Austin API Key: https://utexas.sharepoint.com/sites/AIStudio/SitePages/Getting-Started-with-Claude-Code.aspx?CT=1776970062846&OR=OWA-NT-Mail&CID=b7f143d3-d777-e9d0-87f3-fd195be59bb9#getting-your-ut-austin-api-key)

  1. Enter your integration slug (found in Model Catalog) [I entered csdi-madrlab-anthropic]

 

  1. Enter the model that is enabled for your API key (e.g., haiku) [I entered haiku]

Then it should be set up and you will be able to use Claude code by typing “claude” and hit enter in your terminal.