Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/sandboxes/setup-commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ To configure setup commands for a repository:

Enter your desired setup commands in the provided text area, with one command per line. These commands will be executed in sequence within the sandbox environment.

<Info>
**Important Environment Details:**
- All setup commands run as the **root** user
- Your repository is cloned to the **/workspace** directory
- If you need to run commands as a non-root user, use `su <username> -c "command"` (e.g., `su linuxbrew -c "brew install <package>"`)
- When using quotes inside the `su` command, make sure to escape them properly: `su linuxbrew -c 'brew install "package with spaces"'` or `su linuxbrew -c "brew install \"package with spaces\""`
</Info>

For example, you might want to:

- Switch to a specific Node.js version.
Expand Down Expand Up @@ -67,6 +75,18 @@ npm ci
npm run build
```

```bash
# Running commands as a non-root user (e.g., for Homebrew)
su linuxbrew -c "brew install postgresql"
su linuxbrew -c "brew services start postgresql"

# Handling quotes in commands (using single quotes around the command)
su linuxbrew -c 'brew install "package with spaces"'

# Alternative: escaping double quotes inside the command
su linuxbrew -c "brew install \"package with spaces\""
```

### Working with Different Python Versions

The sandbox comes with Python 3.13 by default, but some packages may not yet be compatible with this version. Here are strategies for handling different Python versions:
Expand Down Expand Up @@ -144,4 +164,3 @@ deactivate
The environment variables listed in the "Env Variables" section are available
during the execution of these setup commands.
</Tip>