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.21 or later (current: 1.25.1) - Download & Install Go
- Windows 10/11 with Administrator privileges for installation
- PowerShell 5.0 or later (included with Windows) for running installer
- 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.2.0The download package contains:
Petroleum-Installer.exe
- Main installerpetroleum.exe
- CLI frontendpetroleumc.exe
- CompilerPetroleum-Uninstaller.exe
- Uninstaller
Install Petroleum
Extract the downloaded ZIP file to any folder, then run the installer with administrator privileges.
- Extract the ZIP file to a temporary folder
- Right-click on
Petroleum-Installer.exe
- Select "Run as administrator"
- Follow the installation prompts
The installer will:
- Create
C:\Program Files\Petroleum\
directory - Copy all executables to the installation directory
- Add Petroleum to your system PATH
- Set up the runtime environment
- Install the uninstaller for easy removal later
Note: You may need to restart your terminal or PowerShell after installation for the PATH changes to take effect.
Verify Installation
Open a new terminal or PowerShell window and verify that Petroleum is installed correctly:
Petroleum Programming Language v0.2.0
Created By: Jeremy Lewis
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
C:\Program Files\Petroleum\bin
is in your PATH - Re-run the installer as administrator
- 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:
- Run
C:\Program Files\Petroleum\Petroleum-Uninstaller.exe
as administrator - This will remove all files and PATH entries
📋 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 C:\Program Files\Petroleum\bin
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.21 or later installed. Check with go version
.
Still having issues? Check the About page for community links and support resources.