본문 바로가기

TroubleShooting/Mac

시작 프로그램 등록 in Mac

728x90

Mac 에서 스크립트 자동 시작하는 방법을 찾으면 Mac - 시스템 환경 설정(설정 아이콘) - 사용자 및 그룹 - 왼쪽 사용자 목록 선택 - "암호 / 로그인 항목" 로그인 항목 선택 - "+" 클릭해서 시작 프로그램 등록으로 많이 나온다.

 

그 방법 말고 Linux(Unit) 에서 init 스크립트 처럼 등록을 하는 방법을 찾아보니 Mac 에도 launchd 데몬이 존재한다.


- launchd 사용(OS X 10.4 Tiger ~) 
plist(property list) 파일을 아래 디렉토리에 작성한다.

 

: 사용자가 로그인했을 때 실행

$ cd /Users/usre1/Library/LaunchAgents
$ ls
homebrew.mxc1.nginx.plist

 

: 시스템 부팅 시 실행

$ su - 
# cd /Library
# cd /Library/LauchDaemons
# ls
com.microsfot.autoupdate.helper.plist     com.microsoft.dlp.install_monitor.plist

 

참고
https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html

 

Creating Launch Daemons and Agents

Creating Launch Daemons and Agents If you are developing daemons to run on OS X, it is highly recommended that you design your daemons to be launchd compliant. Using launchd provides better performance and flexibility for daemons. It also improves the abil

developer.apple.com