💡 このページは100%人間が書きました。
まとめ
caffeinate -dimsu をターミナルで実行することで、 MacBook の蓋を閉じてもスリープさせずに処理を継続させることができる。
caffeinate. --help man caffeinate
oki2a24@oki2aru24noMacBook-Pro ~ % caffeinate --help
caffeinate: illegal option -- -
usage: caffeinate [-disu] [-t timeout] [-w Process ID] [command arguments...]
oki2a24@oki2aru24noMacBook-Pro ~ %
CAFFEINATE(8) System Manager's Manual CAFFEINATE(8)
NAME
caffeinate – prevent the system from sleeping on behalf of a utility
SYNOPSIS
caffeinate [-disu] [-t timeout] [-w pid] [utility arguments...]
DESCRIPTION
caffeinate creates assertions to alter system sleep behavior. If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep. If a utility is specified, caffeinate creates the
assertions on the utility's behalf, and those assertions will persist for the duration of the utility's execution. Otherwise, caffeinate creates the assertions directly, and those assertions will persist
until caffeinate exits.
Available options:
-d Create an assertion to prevent the display from sleeping.
-i Create an assertion to prevent the system from idle sleeping.
-m Create an assertion to prevent the disk from idle sleeping.
-s Create an assertion to prevent the system from sleeping. This assertion is valid only when system is running on AC power.
-u Create an assertion to declare that user is active. If the display is off, this option turns the display on and prevents the display from going into idle sleep. If a timeout is not specified with
'-t' option, then this assertion is taken with a default of 5 second timeout.
-t Specifies the timeout value in seconds for which this assertion has to be valid. The assertion is dropped after the specified timeout. Timeout value is not used when an utility is invoked with this
command.
-w Waits for the process with the specified pid to exit. Once the the process exits, the assertion is also released. This option is ignored when used with utility option.
EXAMPLE
caffeinate -i make
caffeinate forks a process, execs "make" in it, and holds an assertion that prevents idle sleep as long as that process is running.
SEE ALSO
pmset(1)
LOCATION
/usr/bin/caffeinate
Darwin November 9, 2012 Darwin
おわりに
お家で作業しているときは、オプションなしで単純に caffeinate だけを実行しています。 MacBook の蓋をあえて開けておくことで、目に止まった時に、「ああ、作業中だったわ」と思い出せるためです。オプションなしの場合、作業がひと段落して蓋を閉じればスリープするので電池の節約おできます。
今回、移動中もローカルLLMを動かしたいと思った時に、蓋を閉じてもなおローカルLLMを動かし続けるにはどうしたらいいかと思ったのが動機でした。
上手くいっているはずですが、、、ローカルLLMの試行時間が長すぎて本当に動いていたのか少し怪しいです。。。が、しばらくこれでやってみようと思います。
以上です。
