Use append_path/prepend_path as appropriate: https://github.com/Homebrew/homebrew/blob/master/Library/Homebrew/extend/ENV/shared.rb#L52