# mitchellh/go-homedir

Go library for detecting and expanding the user's home directory without cgo.

Repository: https://github.com/mitchellh/go-homedir
Canonical: https://ross.abutalabs.com/products/go-homedir
Homepage: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
Language: Go
License: MIT
License Family: permissive
Archived: true
Last push: 2024-03-21T10:31:41+00:00

## Health v2 (maintenance only)
Score: 10/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 4397, "days_push": 895, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases, archived
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1419, forks 131 (observed 2026-08-28T04:04:40.324617+00:00)

## What it is
A small Go library that detects the user's home directory and expands `~` in paths without requiring cgo. It exists because the standard `os/user` package needs cgo on Darwin, which breaks cross-compilation.

## Use cases
- get the user's home directory in Go without cgo
- expand ~ in file paths to the home directory
- cross-compile Go programs that need the home directory
- replace os/user home directory lookups in Go tools
- resolve user home directory portably across Linux, macOS, and Windows

## When to choose
- you need home directory detection in a Go program that must cross-compile
- you want to expand ~ paths without pulling in cgo dependencies
- you need a tiny, dependency-free utility for path expansion

## When to avoid
- you only target Linux, where os/user works without cgo
- you need more than home directory detection or ~ expansion
- you need a project with active issue triage and new feature development

## Facets
- artifact type: library
- maturity: maintenance
- function: file-system, developer-tools
- domain: developer-tools, cross-platform
- platform: go, cross-platform, windows, bsd
- tags: home-directory, tilde-expansion, no-cgo, cross-compilation, go-library, path-expansion, command-line, linux, macos

## Member repositories
- mitchellh/go-homedir (main) score 10

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:40.324617+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:37:53.981719+00:00, confidence not recorded.
  - readme: https://github.com/mitchellh/go-homedir (fetched 2026-08-28T04:04:40.324617+00:00, sha 283773545296)
  - homepage: https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc (fetched 2026-08-29T11:50:19.338063+00:00, sha 45ba7fc863a7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
