Created
March 26, 2014 17:39
-
-
Save samtsai/9788989 to your computer and use it in GitHub Desktop.
Setup launch agents (useful for automating brew installs and their startup script)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Up Launch Agent to Run On Startup | |
function set_launch_agent() { | |
# retrieve the dependency's prefix | |
DEP_PREFIX=$(brew --prefix ${1}) | |
# make the user local LaunchAgents directory (skip if already exists) | |
mkdir -p ~/Library/LaunchAgents | |
# copy brew generated plist to LaunchAgent | |
cp $DEP_PREFIX/*${1}*.plist ~/Library/LaunchAgents/ | |
# load the agent now | |
launchctl load -w ~/Library/LaunchAgents/*${1}*.plist | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment