Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MacOSXのログインフック設定

Last updated at Posted at 2014-04-06

127.0.0.1以外のループバックアドレスを設定する際、ログインするたびにエイリアスを張るのが面倒なので、ログインフックを使ってみました。
使い方はMacのヘルプに書いてました。

ログインフックとは

Macへのログインを行うたびにシェルスクリプトファイル等を実行する処理

設定方法

ただ設定を追記するのみです。
Macのターミナルにて下記のスクリプトを実行。
これにより、/var/root/Library/Preferences/com.apple.loginwindowのファイルに記述が追記されるみたいです。

# [/path/to/script]は、シェルスクリプトのフルパス
sudo defaults write com.apple.loginwindow LoginHook [/path/to/script]

※新規作成したシェルスクリプトファイルは、実行できるよう権限の設定(chmodコマンド)は忘れずに!

おまけ

またログインだけでなく、ログアウト時にも実行させることができます。
その際は、LoginHookをLogoutHookにするとOKみたいです。
※自身は未検証ですが・・・

19
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
19
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?