Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2018 20:28
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
# create correct file permissions
sudo chmod 644 "/path/to/"
sudo chmod 644 "/path/to/com.mosh.plist"
# create correct file ownerships
sudo chown root:wheel "/path/to/"
sudo chown root:wheel "/path/to/com.mosh.plist"
# create target destination
mkdir -p "/Users/Shared/.startup"
# put files in correct locations for LaunchDaemon
sudo ln -s "${DOTFILES}/path/to/" "/Users/Shared/.startup/"
sudo ln -s "${DOTFILES}/path/to/com.mosh.plist" "/Library/LaunchDaemons/com.mosh.plist"
# add mosh launch daemon
sudo launchctl load -w "/Library/LaunchDaemons/com.mosh.plist"
# wrap in function to allow for local variables
fix_mosh_server() {
# local variables for convenience
local fw='/usr/libexec/ApplicationFirewall/socketfilterfw'
local mosh_sym="$(which mosh-server)"
local mosh_abs="$(greadlink -f $mosh_sym)"
# temporarily shut firewall off
sudo "$fw" --setglobalstate off
# add symlinked location to firewall
sudo "$fw" --add "$mosh_sym"
sudo "$fw" --unblockapp "$mosh_sym"
# add symlinked location to firewall
sudo "$fw" --add "$mosh_abs"
sudo "$fw" --unblockapp "$mosh_abs"
# re-enable firewall
sudo "$fw" --setglobalstate on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment