# In build.zig, how do I mark a LazyPath as executable?

**URL:** <https://ziggit.dev/t/in-build-zig-how-do-i-mark-a-lazypath-as-executable/5704>\
**Category:** Help\
**Tags:** build-system\
**Created:** [August 21, 2024, 9:11am UTC](https://ziggit.dev/t/in-build-zig-how-do-i-mark-a-lazypath-as-executable/5704 "2024-08-21T09:11:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matklad](https://ziggit.dev/user_avatar/ziggit.dev/matklad/32/2462_2.png) [@matklad](https://ziggit.dev/u/matklad)\
**Post date:** [August 21, 2024, 9:11am UTC](https://ziggit.dev/t/in-build-zig-how-do-i-mark-a-lazypath-as-executable/5704/1 "2024-08-21T09:11:56Z")

</div>

I have a build.zig task to create a file on disk, which returns me a `LazyPath`. How do I additionally make sure that the lazy path is marked executable?

The `LazyPath` in question comes originally from a `Step.Run.captureStdOut`.

I guess I can additionally `addSystemCommand(&.{"chmod"})` somewhere, but I’d rather not make this platform specfic.

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [August 21, 2024, 12:01pm UTC](https://ziggit.dev/t/in-build-zig-how-do-i-mark-a-lazypath-as-executable/5704/2 "2024-08-21T12:01:22Z")

</div>

You can use [chmod](https://ziglang.org/documentation/master/std/#std.fs.Dir.chmod) and have a cross platform solution.  
Because `Build` runs at configure time, you must create a custom [Step](https://ziglang.org/documentation/master/std/#std.Build.Step) with a [make function](https://ziglang.org/documentation/master/std/#std.Build.Step.MakeFn) that runs `chmod` at build time.

* * *

I was expecting `Build` to have some kind of `install` that copies files into `bin` and raises the `executable` flag. But I could not find a function like that in `Build`.  
I found that the `executable` flag is raised by the linker outside the standard library.
