Getting Started
Get up and running with Petroleum in minutes. From installation to your first program.
Prerequisites
Before installing Petroleum, you'll need to have Go installed on your system. Petroleum compiles to Go code under the hood, so the Go toolchain is required.
System Requirements
- Go 1.20 or later - Download Go
- Windows 10/11 (x64)
- Command line access (PowerShell, Command Prompt, or Terminal) for compiling programs
🚀 Quick Start
Want to see Petroleum in action right away? Here's a simple program you can try after installation:
print("Hello, Petroleum!")
Save this as hello.pet and run: petroleum run hello.pet
To check if Go is installed, open a terminal and run:
go version go1.25.1 windows/amd64
Download Petroleum
Download the latest Petroleum release package. The download includes everything you need for a complete installation.
Download Petroleum v0.6.5The download package contains:
petroleum.exe- The Petroleum compilerruntime/- Runtime helpers for compiled programs
Install Petroleum
Extract the downloaded ZIP file and run the built-in installer.
- Extract the ZIP file to any location
- Open PowerShell or Command Prompt as Administrator
- Navigate to the extracted folder and run:
petroleum install - Restart your terminal for the PATH changes to take effect
Installing Petroleum...
Copying petroleum.exe...
Copying runtime files...
Installation complete!
Petroleum has been installed to: C:\Program Files\Petroleum\bin
💡 What the installer does
- Installs Petroleum to
C:\Program Files\Petroleum - Automatically adds Petroleum to your PATH
- Removes any previous Petroleum installation
- Warns you if other versions of Petroleum are found in your PATH
To uninstall: Run petroleum uninstall as Administrator
Verify Installation
Open a new terminal or PowerShell window and verify that Petroleum is installed correctly:
Petroleum v0.6.5
If you see the version information, Petroleum is ready to use!
Your First Program
Create your first Petroleum program. Open your favorite text editor and create a file called hello.pet:
print("Hello, Petroleum!")
name = "World"
print("Hello, " + name + "!")
Save the file and run it from your terminal:
Compiled successfully: hello.exe
Hello, Petroleum!
Hello, World!
Congratulations! You've just written and executed your first Petroleum program.
Basic Commands
Petroleum provides several commands to work with your code:
$ petroleum run myprogram.pet
# Compile to executable without running
$ petroleum compile myprogram.pet
# Show version information
$ petroleum --version
# Get help
$ petroleum --help
🔧 Troubleshooting
Command not found
If you get "petroleum is not recognized as an internal or external command":
- Restart your terminal/PowerShell
- Check that your Petroleum folder is in your PATH
- Re-add the folder to PATH if needed
- See our Common Issues FAQ below for more help
Go not found
If you get errors about Go not being found:
- Install Go from go.dev/doc/install
- Restart your terminal after installing Go
- Verify with
go version
Permission errors
If you encounter permission errors during compilation:
- Make sure you have write permissions in your working directory
- Try running your terminal as administrator
Uninstalling
To remove Petroleum from your system:
- Delete the Petroleum folder (e.g.,
C:\Petroleum) - Remove the folder from your system PATH
📋 Common Issues FAQ
"petroleum is not recognized as a command"
Solution: The PATH environment variable wasn't updated properly. Restart your terminal, or manually add your Petroleum folder to your system PATH.
"go: command not found" during compilation
Solution: Install Go from go.dev/doc/install and restart your terminal.
Permission denied errors
Solution: Run your terminal as administrator, or ensure you have write permissions in your working directory.
Version mismatch errors
Solution: Ensure you have Go 1.20 or later installed. Check with go version.
Still having issues? Check the About page for community links and support resources.