Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created November 18, 2010 16:19
Show Gist options
  • Save cowboy/705218 to your computer and use it in GitHub Desktop.
Save cowboy/705218 to your computer and use it in GitHub Desktop.
manServer in OS X
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>manServer</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/Users/YOURUSERNAME/bin/manServer_107.pl</string>
</array>
</dict>
</plist>
#!/bin/bash
# manServer in OS X
#
# by "Cowboy" Ben Alman
# http://benalman.com/
#
# for use with manServer
# http://www.squarebox.co.uk/users/rolf/download/manServer.shtml
# http://www.squarebox.co.uk/users/rolf/download/manServer_107.pl
#
# download manServer_107.pl to ~/bin/
# copy man_init.sh to ~/bin/
# copy com.benalman.manserver.plist to ~/Library/LaunchAgents
#
# edit: com.benalman.manserver.plist, change YOURUSERNAME
# run: launchctl load ~/Library/LaunchAgents/com.benalman.manserver.plist
#
# reference ~/bin/man_init.sh in your .bashrc
if [ ! "$SSH_TTY" ]; then
function man() {
if [ "$(echo $1 | grep '^-')" ]; then
command man "$@"
else
local CMD
if [ "$2" ]; then
CMD="$2.$1"
else
CMD="$1"
fi
open "http://localhost:8888/$CMD"
fi
}
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment