# NoSleep.jl: Keep Julia awake for long calculations

**URL:** <https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911>\
**Category:** Package Announcements\
**Tags:** package, announcement\
**Created:** [October 6, 2025, 8:03am UTC](https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911 "2025-10-06T08:03:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![metelkin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/metelkin/32/218865_2.png) [@metelkin](https://discourse.julialang.org/u/metelkin)\
**Post date:** [October 6, 2025, 8:03am UTC](https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911/1 "2025-10-06T08:03:57Z")

</div>

We’ve recently released a small utility package — [**NoSleep.jl**](https://github.com/hetalang/NoSleep.jl).  
It prevents your laptop or desktop from going to sleep while Julia is performing long computations, and restores the normal sleep behavior when done or failed.

```julia
using NoSleep
@nosleep begin
    # long-running code here
end

```

Of course, as alternative you could just disable sleep mode entirely on your laptop, but then it would keep consuming power even when idle.  
With `@nosleep`, the system stays awake only while computations are running, and goes back to normal afterward. Or set `nosleep_on()` mode for the whole Julia process.

**Features:**

- Cross-platform (Linux, macOS, Windows)
- No dependencies
- Works both as a macro (`@nosleep`) and via simple API: `nosleep_on()` / `nosleep_off()`

Feedback, bug reports, and suggestions are welcome!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [October 6, 2025, 8:24am UTC](https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911/2 "2025-10-06T08:24:05Z")

</div>

Thanks! I was trying to find out how to make my computer keep up with the grindset and this is just the trick.

---

<div class="post-metadata">

**Author:** ![oschulz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oschulz/32/2998_2.png) [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Post date:** [October 6, 2025, 9:15am UTC](https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911/3 "2025-10-06T09:15:06Z")

</div>

Neat!

---

<div class="post-metadata">

**Author:** ![pitipatw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pitipatw/32/211438_2.png) [@pitipatw](https://discourse.julialang.org/u/pitipatw)\
**Post date:** [October 8, 2025, 6:18pm UTC](https://discourse.julialang.org/t/nosleep-jl-keep-julia-awake-for-long-calculations/132911/4 "2025-10-08T18:18:28Z")

</div>

This is brilliant!

My machines can finally get some rest.
