# Error when compiling Zig from source

**URL:** <https://ziggit.dev/t/error-when-compiling-zig-from-source/8650>\
**Category:** Help\
**Tags:** compiler\
**Created:** [February 18, 2025, 8:28pm UTC](https://ziggit.dev/t/error-when-compiling-zig-from-source/8650 "2025-02-18T20:28:32Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![andrewrk](https://ziggit.dev/user_avatar/ziggit.dev/andrewrk/32/7011_2.png) [@andrewrk](https://ziggit.dev/u/andrewrk)\
**Post date:** [February 18, 2025, 11:01pm UTC](https://ziggit.dev/t/error-when-compiling-zig-from-source/8650/5 "2025-02-18T23:01:16Z")

</div>

> `sudo`

I recommend to never use `sudo` to install any software, ever, including Zig.

Leave your package manage to manage your root-owned directories.

When building from source, a good prefix is `~/.local`. With `zig build`, that would be `-p ~/.local`.

To build from source, please follow [the instructions](https://github.com/ziglang/zig/wiki/Contributing#editing-source-code). If you only want to use Zig and not contribute to it, I recommend instead to [download it](https://ziglang.org/download/).

---

_[View the full topic](https://ziggit.dev/t/error-when-compiling-zig-from-source/8650)._
