Thursday, November 28, 2013

Automatically Setting Proxies in OSX for Terminal Windows

If you want your proxies to be set based on network locations add the following to your .bash_profile file (located in your user home directory) using your editor of choice (vi, vim, nano, etc).

CurrentLocation=`networksetup -getcurrentlocation`
if [ "$CurrentLocation" == "Caterpillar" ]; then
    export http_proxy=http://proxy.cat.com:80
    echo http_proxy=http://proxy.cat.com:80
fi

Brew update gives error: Your local changes to the following files would be overwritten by merge:

This happens if your brew repository has become corrupt for some reason or permissions have changed and brew is unable to update.

To fix run the following from a terminal window.

cd `brew --prefix`
git remote add origin https://github.com/mxcl/homebrew.git
git fetch origin
git reset --hard origin/master

Sunday, March 24, 2013

Duplicate "Open With..." Entries in Mac OSX

Removing duplicate items in the Right-Click open with menu can be done as follows:


1. Terminal: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/\
LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user
2. Relaunch Finder: Ctrl+Option+Click Finder -> Relaunch