Skip to main content

Requirements

gopsutil requires Go 1.18 or above. Make sure you have a compatible Go version installed:
go version

Install gopsutil

Install the latest version of gopsutil using go get:
go get github.com/shirou/gopsutil/v4
This will install the v4 branch of gopsutil, which uses Calendar Versioning (CalVer).

Version Numbering

gopsutil uses Calendar Versioning (CalVer) instead of Semantic Versioning. The version format is:
vMAJOR.YY.MM
For example, v4.24.05 means:
  • v4: Major version
  • 24: Release year (2024)
  • 05: Release month (May)
gopsutil aims to maintain backwards compatibility within the same major version. New versions are typically tagged at the end of each month, though releases may be skipped if there are only a few commits.

Basic Import

Import the packages you need in your Go code. Each functionality is organized in separate packages:
package main

import (
    "fmt"
    "github.com/shirou/gopsutil/v4/cpu"
    "github.com/shirou/gopsutil/v4/mem"
    "github.com/shirou/gopsutil/v4/disk"
    "github.com/shirou/gopsutil/v4/host"
)

func main() {
    // Your code here
    fmt.Println("gopsutil is ready!")
}

Platform Support

gopsutil works across multiple operating systems and architectures:
  • Linux: i386, amd64, arm (including Raspberry Pi)
  • Windows: i386, amd64, arm, arm64
  • macOS: amd64, arm64 (Apple Silicon)
  • FreeBSD: i386, amd64, arm
  • OpenBSD: i386, amd64, armv7, arm64, riscv64
  • Solaris: amd64
All functionality is implemented without cgo by porting C structs to Go structs.

Next Steps

Now that you have gopsutil installed, continue to the Quickstart guide to learn how to use it.

Build docs developers (and LLMs) love